1 #ifndef __WLAN_THREAD_H_
2 #define __WLAN_THREAD_H_
4 #include <linux/kthread.h>
7 struct task_struct *task;
8 wait_queue_head_t waitq;
13 static inline void wlan_activate_thread(struct wlan_thread * thr)
15 /** Record the thread pid */
16 thr->pid = current->pid;
18 /** Initialize the wait queue */
19 init_waitqueue_head(&thr->waitq);
22 static inline void wlan_deactivate_thread(struct wlan_thread * thr)
24 lbs_deb_enter(LBS_DEB_THREAD);
28 lbs_deb_leave(LBS_DEB_THREAD);
31 static inline void wlan_create_thread(int (*wlanfunc) (void *),
32 struct wlan_thread * thr, char *name)
34 thr->task = kthread_run(wlanfunc, thr, "%s", name);
37 static inline int wlan_terminate_thread(struct wlan_thread * thr)
39 lbs_deb_enter(LBS_DEB_THREAD);
41 /* Check if the thread is active or not */
43 printk(KERN_ERR "Thread does not exist\n");
46 kthread_stop(thr->task);
48 lbs_deb_leave(LBS_DEB_THREAD);