diff options
author | deischen <deischen@FreeBSD.org> | 2003-11-04 20:04:45 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2003-11-04 20:04:45 +0000 |
commit | 1191fa7e324052c4d97e45f85cbb566eb985c1c6 (patch) | |
tree | c66d125bd34129e0d434c2444369c5dd31c55ad0 /lib/libpthread/thread/thr_private.h | |
parent | 573b8090444db7cfee8d60b937cc6d39632c8bbc (diff) | |
download | FreeBSD-src-1191fa7e324052c4d97e45f85cbb566eb985c1c6.zip FreeBSD-src-1191fa7e324052c4d97e45f85cbb566eb985c1c6.tar.gz |
Add an implementation for pthread_atfork().
Aside from the POSIX requirements for pthread_atfork(), when
fork()ing, take the malloc lock to keep malloc state consistent
in the child.
Reviewed by: davidxu
Diffstat (limited to 'lib/libpthread/thread/thr_private.h')
-rw-r--r-- | lib/libpthread/thread/thr_private.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/libpthread/thread/thr_private.h b/lib/libpthread/thread/thr_private.h index 518e881..d8453ff 100644 --- a/lib/libpthread/thread/thr_private.h +++ b/lib/libpthread/thread/thr_private.h @@ -442,6 +442,13 @@ struct pthread_cleanup { void *routine_arg; }; +struct pthread_atfork { + TAILQ_ENTRY(pthread_atfork) qe; + void (*prepare)(void); + void (*parent)(void); + void (*child)(void); +}; + struct pthread_attr { int sched_policy; int sched_inherit; @@ -997,6 +1004,9 @@ SCLASS TAILQ_HEAD(, pthread) _thread_gc_list SCLASS int _thr_active_threads SCLASS_PRESET(1); +SCLASS TAILQ_HEAD(atfork_head, pthread_atfork) _thr_atfork_list; +SCLASS pthread_mutex_t _thr_atfork_mutex; + /* Default thread attributes: */ SCLASS struct pthread_attr _pthread_attr_default SCLASS_PRESET({ @@ -1109,8 +1119,11 @@ void _thr_exit(char *, int, char *); void _thr_exit_cleanup(void); void _thr_lock_wait(struct lock *lock, struct lockuser *lu); void _thr_lock_wakeup(struct lock *lock, struct lockuser *lu); +void _thr_mutex_reinit(pthread_mutex_t *); int _thr_ref_add(struct pthread *, struct pthread *, int); void _thr_ref_delete(struct pthread *, struct pthread *); +void _thr_rtld_init(void); +void _thr_rtld_fini(void); int _thr_schedule_add(struct pthread *, struct pthread *); void _thr_schedule_remove(struct pthread *, struct pthread *); void _thr_setrunnable(struct pthread *curthread, struct pthread *thread); |