diff options
-rw-r--r-- | e-util/ChangeLog | 6 | ||||
-rw-r--r-- | e-util/e-msgport.c | 13 |
2 files changed, 18 insertions, 1 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index c2ffa92702..480b2f7ace 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,9 @@ +2001-01-30 Not Zed <NotZed@Ximian.com> + + * e-msgport.c (e_thread_destroy): Turn on joining of cancelled threads. + (e_msgport_wait): Put a cleanup handler to clear the mp lock if it + happens in cond_wait, since it will be locked again. + 2001-01-29 Not Zed <NotZed@Ximian.com> * e-msgport.c (e_thread_put): If we have waiting threads, then diff --git a/e-util/e-msgport.c b/e-util/e-msgport.c index 58d75b16f8..d252670ad0 100644 --- a/e-util/e-msgport.c +++ b/e-util/e-msgport.c @@ -171,6 +171,14 @@ void e_msgport_put(EMsgPort *mp, EMsg *msg) m(printf("put: done\n")); } +static void +msgport_cleanlock(void *data) +{ + EMsgPort *mp = data; + + g_mutex_unlock(mp->lock); +} + EMsg *e_msgport_wait(EMsgPort *mp) { EMsg *msg; @@ -181,7 +189,10 @@ EMsg *e_msgport_wait(EMsgPort *mp) if (mp->pipe.fd.read == -1) { m(printf("wait: waiting on condition\n")); mp->condwait++; + /* if we are cancelled in the cond-wait, then we need to unlock our lock when we cleanup */ + pthread_cleanup_push(msgport_cleanlock, mp); g_cond_wait(mp->cond, mp->lock); + pthread_cleanup_pop(0); m(printf("wait: got condition\n")); mp->condwait--; } else { @@ -349,7 +360,7 @@ void e_thread_destroy(EThread *e) printf("cleaning up pool thread %d\n", info->id); pthread_mutex_unlock(&e->mutex); if (pthread_cancel(info->id) == 0) - /*pthread_join(info->id, 0);*/ + pthread_join(info->id, 0); pthread_mutex_lock(&e->mutex); printf("cleaned up ok\n"); g_free(info); |