diff options
author | julian <julian@FreeBSD.org> | 1997-02-05 23:26:09 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1997-02-05 23:26:09 +0000 |
commit | c2f7c3e4893b6b5c4494d549b3645e06664bc1b1 (patch) | |
tree | b2e6d3017e236268263978b585f2150cd10b1689 /lib/libc_r/uthread/uthread_init.c | |
parent | 321f03c8eddd8cf5aa81836ff1932a74156d30cb (diff) | |
download | FreeBSD-src-c2f7c3e4893b6b5c4494d549b3645e06664bc1b1.zip FreeBSD-src-c2f7c3e4893b6b5c4494d549b3645e06664bc1b1.tar.gz |
Submitted by: John Birrell
uthreads update from the author.
Diffstat (limited to 'lib/libc_r/uthread/uthread_init.c')
-rw-r--r-- | lib/libc_r/uthread/uthread_init.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/libc_r/uthread/uthread_init.c b/lib/libc_r/uthread/uthread_init.c index d044063..2adc34f 100644 --- a/lib/libc_r/uthread/uthread_init.c +++ b/lib/libc_r/uthread/uthread_init.c @@ -44,7 +44,11 @@ #include <machine/reg.h> #include <pthread.h> #include "pthread_private.h" +extern int _thread_autoinit_dummy_decl; +/* + * Threaded process initialization + */ void _thread_init(void) { @@ -52,15 +56,25 @@ _thread_init(void) int i; struct sigaction act; + /* Ensure that the auto-initialization routine is linked in: */ + _thread_autoinit_dummy_decl = 1; + /* Check if this function has already been called: */ - if (_thread_initial) { + if (_thread_initial) /* Only initialise the threaded application once. */ - } + return; + + /* Get the standard I/O flags before messing with them : */ + for (i = 0; i < 3; i++) + if ((_pthread_stdio_flags[i] = + _thread_sys_fcntl(i,F_GETFL, NULL)) == -1) + PANIC("Cannot get stdio flags"); + /* * Create a pipe that is written to by the signal handler to prevent * signals being missed in calls to _thread_sys_select: */ - else if (_thread_sys_pipe(_thread_kern_pipe) != 0) { + if (_thread_sys_pipe(_thread_kern_pipe) != 0) { /* Cannot create pipe, so abort: */ PANIC("Cannot create kernel pipe"); } |