Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions src/rtapi/uspace_rtapi_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,8 @@ struct PosixTask : rtapi_task

struct Posix : RtapiApp
{
Posix(int policy = SCHED_FIFO) : RtapiApp(policy), do_thread_lock(policy != SCHED_FIFO) {
Posix(int policy = SCHED_FIFO) : RtapiApp(policy) {
pthread_once(&key_once, init_key);
if(do_thread_lock)
pthread_mutex_init(&thread_lock, 0);
}
int task_delete(int id);
int task_start(int task_id, unsigned long period_nsec);
Expand All @@ -618,8 +616,6 @@ struct Posix : RtapiApp
void do_outb(unsigned char value, unsigned int port);
int run_threads(int fd, int (*callback)(int fd));
static void *wrapper(void *arg);
bool do_thread_lock;
pthread_mutex_t thread_lock;

static pthread_once_t key_once;
static pthread_key_t key;
Expand Down Expand Up @@ -1041,10 +1037,6 @@ void *Posix::wrapper(void *arg)

pthread_setspecific(key, arg);

Posix &papp = reinterpret_cast<Posix&>(App());
if(papp.do_thread_lock)
pthread_mutex_lock(&papp.thread_lock);

struct timespec now;
clock_gettime(RTAPI_CLOCK, &now);
rtapi_timespec_advance(task->nextstart, now, task->period + task->pll_correction);
Expand Down Expand Up @@ -1086,8 +1078,6 @@ int Posix::task_self() {
}

void Posix::wait() {
if(do_thread_lock)
pthread_mutex_unlock(&thread_lock);
pthread_testcancel();
struct rtapi_task *task = reinterpret_cast<rtapi_task*>(pthread_getspecific(key));
rtapi_timespec_advance(task->nextstart, task->nextstart, task->period + task->pll_correction);
Expand All @@ -1103,8 +1093,6 @@ void Posix::wait() {
int res = rtapi_clock_nanosleep(RTAPI_CLOCK, TIMER_ABSTIME, &task->nextstart, nullptr, &now);
if(res < 0) perror("clock_nanosleep");
}
if(do_thread_lock)
pthread_mutex_lock(&thread_lock);
}

unsigned char Posix::do_inb(unsigned int port)
Expand Down