Add a global variable called __isthreaded that can be tested throughout

libc to determine if locking is required. This is needed in libc
for use with kernel threads, but until a thread is created, we don't
really want to bother locking things. The variable was added here
because the crt code calls exit(main()) so all programs will get the
variable.
This commit is contained in:
John Birrell 1998-04-11 07:02:58 +00:00
parent 01c70c0055
commit f901bc2795

View file

@ -41,6 +41,15 @@ static char sccsid[] = "@(#)exit.c 8.1 (Berkeley) 6/4/93";
void (*__cleanup)();
/*
* This variable is zero until a process has created a thread.
* It is used to avoid calling locking functions in libc when they
* are not required. By default, libc is intended to be(come)
* thread-safe, but without a (significant) penalty to non-threaded
* processes.
*/
int __isthreaded = 0;
/*
* Exit, flushing stdio buffers if necessary.
*/