Skip to content

Commit 67d61ba

Browse files
committed
Cleanup: Get rid of globals find_rt_cpu_number / set_namef
1 parent 4c1a0de commit 67d61ba

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/rtapi/uspace_rtapi_app.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ static void parse_cpu_list(const char *path, cpu_set_t *cpuset) {
234234
fclose(fp);
235235
}
236236

237-
int find_rt_cpu_number() {
237+
int RtapiApp::find_rt_cpu_number() {
238238
if (getenv("RTAPI_CPU_NUMBER"))
239239
return atoi(getenv("RTAPI_CPU_NUMBER"));
240240

@@ -269,7 +269,7 @@ int find_rt_cpu_number() {
269269
#endif
270270
}
271271

272-
void set_namef(const char *fmt, ...) {
272+
void RtapiApp::set_namef(const char *fmt, ...) {
273273
char *buf = NULL;
274274
va_list ap;
275275

src/rtapi/uspace_rtapi_app.hh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ struct RtapiApp {
110110
virtual int run_threads(int fd, int (*callback)(int fd)) = 0;
111111
virtual long long do_get_time(void) = 0;
112112
virtual void do_delay(long ns) = 0;
113+
static int find_rt_cpu_number();
114+
static void set_namef(const char *fmt, ...);
113115
int policy;
114116
long period;
115117
static struct rtapi_task *task_array[MAX_TASKS];
@@ -119,8 +121,5 @@ template <class T = rtapi_task> T *rtapi_get_task(int task_id) {
119121
return static_cast<T *>(RtapiApp::get_task(task_id));
120122
}
121123

122-
int find_rt_cpu_number();
123-
void set_namef(const char *fmt, ...);
124-
125124
#define WITH_ROOT WithRoot root
126125
#endif

src/rtapi/uspace_rtapi_main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static boost::lockfree::queue<message_t, boost::lockfree::capacity<128>> rtapi_m
7070

7171
static pthread_t queue_thread;
7272
static void *queue_function(void * /*arg*/) {
73-
set_namef("rtapi_app:mesg");
73+
RtapiApp::set_namef("rtapi_app:mesg");
7474
// note: can't use anything in this function that requires App() to exist
7575
// but it's OK to use functions that aren't safe for realtime (that's the
7676
// point of running this in a thread)

0 commit comments

Comments
 (0)