[sheepdog] [PATCH v5 1/2] sheep/cluster: use pthread_cond instread of pthread_mutex to avoid panic

Liu Yuan namei.unix at gmail.com
Mon Jan 20 05:58:36 CET 2014


On Sun, Jan 19, 2014 at 10:39:08PM +0800, Robin Dong wrote:
> From: Robin Dong <sanbai at taobao.com>
> 
> If we use pthread like this:
> 
> 	pthread_mutex_t mt;
> 	pthread_mutex_init(&mt, NULL);
> 	pthread_mutex_unlock(&mt);
> 	pthread_mutex_destroy(&mt);
> 
> The last 'pthread_mutex_destroy()' will return EBUSY because the mutex has
> been 'unlocked' even no one locked it.
> (ref: https://bugzilla.redhat.com/show_bug.cgi?id=113588)
> 
> This will cause problem in cluster/zookeeper.c because any event from zk_watcher()
> would unlocked the 'wait_wakeup' mutex. Therefore we need to use pthread-condition
> to replace pthread-mutex.

Applied, thanks

Yuan



More information about the sheepdog mailing list