From c2f7c3e4893b6b5c4494d549b3645e06664bc1b1 Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 5 Feb 1997 23:26:09 +0000 Subject: Submitted by: John Birrell uthreads update from the author. --- lib/libc_r/uthread/uthread_init.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'lib/libc_r/uthread/uthread_init.c') 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 #include #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"); } -- cgit v1.1