Mercurial > hg > freeDiameter
diff libfdcore/p_psm.c @ 691:78b665400097
Cleanup all pthread_cleanup_push / pop pairs so that pop is always called after push, or ASSERT(0) is some grave errors
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Thu, 20 Jan 2011 19:44:27 +0900 |
parents | 8c3dc8584dab |
children | 4ffbc9f1e922 |
line wrap: on
line diff
--- a/libfdcore/p_psm.c Thu Jan 20 15:38:12 2011 +0900 +++ b/libfdcore/p_psm.c Thu Jan 20 19:44:27 2011 +0900 @@ -54,17 +54,18 @@ /* Wait for start signal */ static int fd_psm_waitstart() { + int ret = 0; TRACE_ENTRY(""); CHECK_POSIX( pthread_mutex_lock(&started_mtx) ); awake: - if (! started) { + if (!ret && !started) { pthread_cleanup_push( fd_cleanup_mutex, &started_mtx ); - CHECK_POSIX( pthread_cond_wait(&started_cnd, &started_mtx) ); + CHECK_POSIX_DO( ret = pthread_cond_wait(&started_cnd, &started_mtx), ); pthread_cleanup_pop( 0 ); goto awake; } CHECK_POSIX( pthread_mutex_unlock(&started_mtx) ); - return 0; + return ret; } /* Allow the state machines to start */