X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/6dbd69eeb947673bbcb552f83f439cf8516b19f6..c1a3209a7cdb41a4a78caf3a5e0d3435deb4e43d:/lincan/src/kthread.c diff --git a/lincan/src/kthread.c b/lincan/src/kthread.c index d2531b9..ae43c30 100644 --- a/lincan/src/kthread.c +++ b/lincan/src/kthread.c @@ -1,5 +1,7 @@ -#include #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)) +#include +#endif #if defined(MODVERSIONS) #include @@ -10,15 +12,21 @@ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,40)) #include #else - #include + #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)) + #include + #endif #endif #include #include #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) + #include +#else + #include +#endif -#include #include #include "../include/kthread.h" @@ -47,7 +55,7 @@ void start_kthread(void (*func)(kthread_t *), kthread_t *kthread) in the down operation below until the thread has reached the up() operation. */ - init_MUTEX_LOCKED(&kthread->startstop_sem); + sema_init(&kthread->startstop_sem, 0); /* store the function to be executed in the data passed to the launcher */ @@ -96,10 +104,10 @@ void stop_kthread(kthread_t *kthread) will unlock it. As soon as we see the semaphore unlocked, we know that the thread has exited. */ - init_MUTEX_LOCKED(&kthread->startstop_sem); + sema_init(&kthread->startstop_sem,0); /* We need to do a memory barrier here to be sure that - the flags are visible on all CPUs. + the flags are visible on all CPUs. */ mb(); @@ -107,7 +115,7 @@ void stop_kthread(kthread_t *kthread) kthread->terminate = 1; /* We need to do a memory barrier here to be sure that - the flags are visible on all CPUs. + the flags are visible on all CPUs. */ mb(); kill_proc(kthread->thread->pid, SIGKILL, 1);