diff options
author | Zheng Da <zhengda1936@gmail.com> | 2009-12-11 15:14:14 +0100 |
---|---|---|
committer | Zheng Da <zhengda1936@gmail.com> | 2009-12-11 15:14:14 +0100 |
commit | 0451c065a044b9791b5cfa6a2432bcb8d1342710 (patch) | |
tree | 43506962d0c01ad31554c2002088f96de8ae704e | |
parent | f1a048ea762dd2ea79cad074ec04a0b332a2c221 (diff) |
destroy the port before the thread exits.
-rw-r--r-- | libddekit/thread.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libddekit/thread.c b/libddekit/thread.c index 081a4742..48720584 100644 --- a/libddekit/thread.c +++ b/libddekit/thread.c @@ -187,8 +187,8 @@ void ddekit_thread_sleep(ddekit_lock_t *lock) { condition_wait (data->sleep_cond, (struct mutex *) *lock); } -void dekit_thread_wakeup(ddekit_thread_t *td) { - struct _ddekit_private_data *data = cthread_ldata (cthread_self ()); +void ddekit_thread_wakeup(ddekit_thread_t *td) { + struct _ddekit_private_data *data = cthread_ldata (&td->thread); condition_signal (data->sleep_cond); } @@ -198,12 +198,14 @@ void ddekit_thread_exit() { struct _ddekit_private_data *data; cthread_t t = cthread_self (); - // TODO I hope I don't need a lock to protect ldata and name. + // TODO I need a lock to protect ldata and name. /* I have to free the sleep condition variable * before the thread exits. */ data = cthread_ldata (t); cthread_set_ldata (t, NULL); + mach_port_destroy (mach_task_self (), + data->wakeupmsg.msgh_remote_port); condition_free (data->sleep_cond); ddekit_simple_free (data); |