diff options
Diffstat (limited to 'lib/thread.h')
| -rw-r--r-- | lib/thread.h | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/thread.h b/lib/thread.h index c22b2105cd..a581796d30 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -89,6 +89,8 @@ struct thread_master { pthread_t owner; }; +typedef struct thread_master event_master; + /* Thread itself. */ struct thread { uint8_t type; /* thread type */ @@ -147,17 +149,10 @@ struct cpu_thread_history { #define THREAD_FD(X) ((X)->u.fd) #define THREAD_VAL(X) ((X)->u.val) -#define THREAD_OFF(thread) \ - do { \ - if (thread) { \ - thread_cancel(thread); \ - thread = NULL; \ - } \ - } while (0) - -#define THREAD_READ_OFF(thread) THREAD_OFF(thread) -#define THREAD_WRITE_OFF(thread) THREAD_OFF(thread) -#define THREAD_TIMER_OFF(thread) THREAD_OFF(thread) +#define THREAD_OFF(thread) thread_cancel(&(thread)) +#define THREAD_READ_OFF(thread) thread_cancel(&(thread)) +#define THREAD_WRITE_OFF(thread) thread_cancel(&(thread)) +#define THREAD_TIMER_OFF(thread) thread_cancel(&(thread)) #define debugargdef const char *funcname, const char *schedfrom, int fromln @@ -207,7 +202,7 @@ extern void funcname_thread_execute(struct thread_master *, debugargdef); #undef debugargdef -extern void thread_cancel(struct thread *); +extern void thread_cancel(struct thread **event); extern void thread_cancel_async(struct thread_master *, struct thread **, void *); extern void thread_cancel_event(struct thread_master *, void *); |
