Date: Wed, 1 Sep 2010 03:55:10 +0000 (UTC) From: David Xu <davidxu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r212078 - head/lib/libthr/thread Message-ID: <201009010355.o813tAjI050520@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: davidxu Date: Wed Sep 1 03:55:10 2010 New Revision: 212078 URL: http://svn.freebsd.org/changeset/base/212078 Log: pthread_atfork should acquire writer lock and protect the code with critical region. Modified: head/lib/libthr/thread/thr_fork.c Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Wed Sep 1 03:11:21 2010 (r212077) +++ head/lib/libthr/thread/thr_fork.c Wed Sep 1 03:55:10 2010 (r212078) @@ -89,9 +89,11 @@ _pthread_atfork(void (*prepare)(void), v af->prepare = prepare; af->parent = parent; af->child = child; - _thr_rwl_rdlock(&_thr_atfork_lock); + THR_CRITICAL_ENTER(curthread); + _thr_rwl_wrlock(&_thr_atfork_lock); TAILQ_INSERT_TAIL(&_thr_atfork_list, af, qe); _thr_rwl_unlock(&_thr_atfork_lock); + THR_CRITICAL_LEAVE(curthread); return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009010355.o813tAjI050520>