summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>2009-05-11 16:45:53 +0000
committergreen <green@FreeBSD.org>2009-05-11 16:45:53 +0000
commitf397f112f77595904028cf01a4a24e7a7b550494 (patch)
tree16695c53706523c6eed39491dbb2b6a2d2eeac16 /lib/libthr
parentc639aa3d25c7a98394ec85bf76a36d928ad76c42 (diff)
downloadFreeBSD-src-f397f112f77595904028cf01a4a24e7a7b550494.zip
FreeBSD-src-f397f112f77595904028cf01a4a24e7a7b550494.tar.gz
These are some cosmetic changes to improve the clarity of libthr's fork implementation.
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/thread/thr_fork.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/libthr/thread/thr_fork.c b/lib/libthr/thread/thr_fork.c
index afb5a1d..529f38f 100644
--- a/lib/libthr/thread/thr_fork.c
+++ b/lib/libthr/thread/thr_fork.c
@@ -105,7 +105,7 @@ _fork(void)
struct pthread_atfork *af;
pid_t ret;
int errsave;
- int unlock_malloc;
+ int was_threaded;
int rtld_locks[MAX_RTLD_LOCKS];
if (!_thr_is_inited())
@@ -122,16 +122,16 @@ _fork(void)
}
/*
- * Try our best to protect memory from being corrupted in
- * child process because another thread in malloc code will
- * simply be kill by fork().
+ * All bets are off as to what should happen soon if the parent
+ * process was not so kindly as to set up pthread fork hooks to
+ * relinquish all running threads.
*/
if (_thr_isthreaded() != 0) {
- unlock_malloc = 1;
+ was_threaded = 1;
_malloc_prefork();
_rtld_atfork_pre(rtld_locks);
} else {
- unlock_malloc = 0;
+ was_threaded = 0;
}
/*
@@ -159,7 +159,7 @@ _fork(void)
_thr_umutex_init(&curthread->lock);
_thr_umutex_init(&_thr_atfork_lock);
- if (unlock_malloc)
+ if (was_threaded)
_rtld_atfork_post(rtld_locks);
_thr_setthreaded(0);
@@ -173,7 +173,7 @@ _fork(void)
/* Ready to continue, unblock signals. */
_thr_signal_unblock(curthread);
- if (unlock_malloc) {
+ if (was_threaded) {
__isthreaded = 1;
_malloc_postfork();
__isthreaded = 0;
@@ -191,7 +191,7 @@ _fork(void)
/* Ready to continue, unblock signals. */
_thr_signal_unblock(curthread);
- if (unlock_malloc) {
+ if (was_threaded) {
_rtld_atfork_post(rtld_locks);
_malloc_postfork();
}
OpenPOWER on IntegriCloud