summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_init.c
Commit message (Collapse)AuthorAgeFilesLines
* Move the initialization of thread priority to a common function.mtm2004-02-181-5/+3
|
* Preparations to make libthr work in multi-threaded fork()ing applications.mtm2003-12-261-39/+78
| | | | | | | | | | | | | o Remove some code duplication between _thread_init(), which is run once to initialize libthr and the intitial thread, and pthread_create(), which initializes newly created threads, into a new function called from both places: init_td_common() o Move initialization of certain parts of libthr into a separate function. These include: - Active threads list and it's lock - Dead threads list and it's lock & condition variable - Naming and insertion of the initial thread into the active threads list.
* When _PTHREADSINVARIANTS is defined SIGABRT is not includedmtm2003-07-081-0/+3
| | | | | | in the set of signals to block. Also, make the PANIC macro call abort() instead of simply exiting.
* Make _thread_suspend work with both the old broken sigtimedwaitjdp2003-06-291-0/+26
| | | | | | implementation and the new improved one. We now precompute the signal set passed to sigtimedwait, using an inverted set when necessary for compatibility with older kernels.
* Make C applications statically compiled with libthr work. Previously,mtm2003-06-041-0/+6
| | | | | | an application compiled -static with libthr would dump core in malloc(3) because the stub thread initialization routine in libc would be used instead of the libthr supplied one.
* Return gracefully, rather than aborting, when the maximum concurrentmtm2003-05-251-1/+2
| | | | | | threads per process has been reached. Return EAGAIN, as per spec. Approved by: re/blanket libthr
* Start locking up the active and dead threads lists. The active threadsmtm2003-05-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | list is protected by a spinlock_t, but the dead list uses a pthread_mutex because it is necessary to synchronize other threads with the garbage collector thread. Lock/Unlock macros are used so it's easier to make changes to the locks in the future. The 'dead thread list' lock is intended to replace the gc mutex. This doesn't have any practical ramifications. It simply makes it clearer what the purpose of the lock is. The gc will use this lock, instead of the gc mutex, to synchronize access to the dead list with other threads. Modify _pthread_exit() to use these two new locks instead of GIANT_LOCK, and also to properly lock and protect thread state changes, especially with respect to a joining thread. The gc thread was also re-arranged to be more organized and less nested. _pthread_join() was also modified to use the thread list locks. However, locking and unlocking here needs special care because a thread could find itself in a position where it's joining an exiting thread that is waiting on the dead list lock, which this thread (joiner) holds. If the joiner doesn't take care to lock *and* unlock in the same order they (the joiner and the joinee) could deadlock against each other. Approved by: re/blanket libthr
* Make WARNS2 clean. The fixes mostly included:mtm2003-05-231-2/+1
| | | | | | | | o removed unused variables o explicit inclusion of header files o prototypes for externally defined functions Approved by: re/blanket libthr
* The thread id was being set *before* zeroing out the thread. Reversemtm2003-05-211-2/+3
| | | | | | the order. Approved by: markm/mentor, re/blanket libthr
* - Pass a ucontext_t to _set_curthread. If non-NULL the new thread is setjake2003-04-031-1/+1
| | | | | | | | as curthread in the new context, so that it will be set automatically when the thread is switched to. This fixes a race where we'd run for a little while with curthread unset in _thread_start. Reviewed by: jeff
* - Define curthread as _get_curthread() and remove all direct calls tojeff2003-04-021-16/+0
| | | | | | | _get_curthread(). This is similar to the kernel's curthread. Doing this saves stack overhead and is more convenient to the programmer. - Pass the pointer to the newly created thread to _thread_init(). - Remove _get_curthread_slow().
* - Add libthr but don't hook it up to the regular build yet. This is anjeff2003-04-011-0/+363
adaptation of libc_r for the thr system call interface. This is beta quality code.
OpenPOWER on IntegriCloud