From 07adfc3d98d69f8a0bc6828588bde6785f3d08b4 Mon Sep 17 00:00:00 2001 From: brian Date: Sat, 24 Sep 2005 01:19:53 +0000 Subject: Modify the code path of the ifdef NOTYET part of _kse_single_thread(): o Don't reinitialise the atfork() handler list in the child. We are meant to call the child handler, and on subsequent fork()s should call all three functions as normal. o Don't reinitialise the thread specific keyed data in the child after a fork. Applications may require this for context. o Reinitialise curthread->tlflags after removing ourselves from (and reinitialising) the various internal thread lists. o Reinitialise __malloc_lock in the child after fork() (to balance our explicitly taking the lock prior to the fork()). With these changes, it is possible to enable the NOTYET code in thr_kern.c to allow the use of non-async-safe functions after fork()ing from a threaded program. Reviewed by: Daniel Eischen [_malloc_lock reinitialisation has since been moved to avoid polluting the !NOTYET code] --- lib/libkse/thread/thr_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libkse/thread/thr_init.c') diff --git a/lib/libkse/thread/thr_init.c b/lib/libkse/thread/thr_init.c index c143627..e5439ad 100644 --- a/lib/libkse/thread/thr_init.c +++ b/lib/libkse/thread/thr_init.c @@ -437,6 +437,7 @@ init_private(void) } _pthread_attr_default.guardsize_attr = _thr_guard_default; _pthread_attr_default.stacksize_attr = _thr_stack_default; + TAILQ_INIT(&_thr_atfork_list); init_once = 1; /* Don't do this again. */ } else { /* @@ -453,7 +454,6 @@ init_private(void) /* Initialize everything else. */ TAILQ_INIT(&_thread_list); TAILQ_INIT(&_thread_gc_list); - TAILQ_INIT(&_thr_atfork_list); _pthread_mutex_init(&_thr_atfork_mutex, NULL); /* -- cgit v1.1