diff options
author | Not Zed <NotZed@Ximian.com> | 2001-01-31 07:08:25 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-01-31 07:08:25 +0800 |
commit | 80697cc5ad12ff9397875c479eef65265f2f7215 (patch) | |
tree | 0ab8d8fe6228fa58955b6c552f2bf1d5da44f09b | |
parent | 242775d1108a1ff41781c133b12ccb7f8f4156c1 (diff) | |
download | gsoc2013-evolution-80697cc5ad12ff9397875c479eef65265f2f7215.tar gsoc2013-evolution-80697cc5ad12ff9397875c479eef65265f2f7215.tar.gz gsoc2013-evolution-80697cc5ad12ff9397875c479eef65265f2f7215.tar.bz2 gsoc2013-evolution-80697cc5ad12ff9397875c479eef65265f2f7215.tar.lz gsoc2013-evolution-80697cc5ad12ff9397875c479eef65265f2f7215.tar.xz gsoc2013-evolution-80697cc5ad12ff9397875c479eef65265f2f7215.tar.zst gsoc2013-evolution-80697cc5ad12ff9397875c479eef65265f2f7215.zip |
Turn on joining of cancelled threads. (e_msgport_wait): Put a cleanup
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.
svn path=/trunk/; revision=7919
-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); |