Commit | Line | Data |
---|---|---|
15a4bc17 GKH |
1 | /* |
2 | * OSKA Linux implementation -- threading | |
3 | * | |
4 | * Copyright (C) 2007 Cambridge Silicon Radio Ltd. | |
5 | * | |
6 | * Refer to LICENSE.txt included with this source code for details on | |
7 | * the license terms. | |
8 | */ | |
9 | #ifndef __OSKA_LINUX_THREAD_H | |
10 | #define __OSKA_LINUX_THREAD_H | |
11 | ||
12 | #include <linux/version.h> | |
13 | #include <linux/kernel.h> | |
14 | #include <linux/kthread.h> | |
15 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19) | |
16 | #include <linux/freezer.h> | |
17 | #endif | |
18 | #include "event.h" | |
19 | ||
20 | struct os_thread_lx { | |
21 | void (*func)(void *); | |
22 | void *arg; | |
23 | struct task_struct *task; | |
24 | int stop; | |
25 | }; | |
26 | ||
27 | typedef struct os_thread_lx os_thread_t; | |
28 | ||
29 | int os_thread_create(os_thread_t *thread, const char *name, | |
30 | void (*func)(void *), void *arg); | |
31 | void os_thread_stop(os_thread_t *thread, os_event_t *evt); | |
32 | int os_thread_should_stop(os_thread_t *thread); | |
33 | ||
34 | static inline void os_try_suspend_thread(os_thread_t *thread) | |
35 | { | |
36 | try_to_freeze(); | |
37 | } | |
38 | ||
39 | #endif /* __OSKA_LINUX_THREAD_H */ |