summaryrefslogtreecommitdiff
path: root/lib/libthr/thread/thr_init.c
Commit message (Collapse)AuthorAgeFilesLines
* Make C applications statically compiled with libthr work. Previously,Mike Makonnen2003-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. Notes: svn path=/head/; revision=115820
* Return gracefully, rather than aborting, when the maximum concurrentMike Makonnen2003-05-251-1/+2
| | | | | | | | | threads per process has been reached. Return EAGAIN, as per spec. Approved by: re/blanket libthr Notes: svn path=/head/; revision=115313
* Start locking up the active and dead threads lists. The active threadsMike Makonnen2003-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 Notes: svn path=/head/; revision=115305
* Make WARNS2 clean. The fixes mostly included:Mike Makonnen2003-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 Notes: svn path=/head/; revision=115260
* The thread id was being set *before* zeroing out the thread. ReverseMike Makonnen2003-05-211-2/+3
| | | | | | | | | the order. Approved by: markm/mentor, re/blanket libthr Notes: svn path=/head/; revision=115195
* - Pass a ucontext_t to _set_curthread. If non-NULL the new thread is setJake Burkholder2003-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 Notes: svn path=/head/; revision=112995
* - Define curthread as _get_curthread() and remove all direct calls toJeff Roberson2003-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(). Notes: svn path=/head/; revision=112965
* - Add libthr but don't hook it up to the regular build yet. This is anJeff Roberson2003-04-011-0/+363
adaptation of libc_r for the thr system call interface. This is beta quality code. Notes: svn path=/head/; revision=112918