summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_exit.c
Commit message (Collapse)AuthorAgeFilesLines
* Implement reference counting of read-write locks. This usesmtm2004-01-191-0/+6
| | | | | | | | | | | | | | | | | a list in the thread structure to keep track of the locks and how many times they have been locked. This list is checked on every lock and unlock. The traversal through the list is O(n). Most applications don't hold so many locks at once that this will become a problem. However, if it does become a problem it might be a good idea to review this once libthr is off probation and in the optimization cycle. This fixes: o deadlock when a thread tries to recursively acquire a read lock when a writer is waiting on the lock. o a thread could previously successfully unlock a lock it did not own o deadlock when a thread tries to acquire a write lock on a lock it already owns for reading or writing [ this is admittedly not required by POSIX, but is nice to have ]
* Change all instances of THR_LOCK/UNLOCK, etc to UMTX_*.mtm2003-07-061-2/+2
| | | | | It is a more acurate description of the locks they operate on.
* Sweep through pthread locking and use the new locking primitives formtm2003-06-291-2/+2
| | | | libthr.
* Don't hold the active thread list lock when signaling the gc thread.mtm2003-05-291-11/+13
| | | | | | | | | The dead list thread is sufficient for synchronization. Retire the arch_id (ldt array slot) in the gc thread instead of the doing it in the thread itself. Approved by: re/jhb
* Minimize the potential for deadlocks between an exiting thread and it'smtm2003-05-271-2/+18
| | | | | | | | joiner by making sure all locks and unlocks occur in the same order. For the record the lock order is: DEAD_LIST, THREAD_LIST, exiting thread, joiner thread. Approved by: re/rwatson
* Start locking up the active and dead threads lists. The active threadsmtm2003-05-251-30/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+3
| | | | | | | | o removed unused variables o explicit inclusion of header files o prototypes for externally defined functions Approved by: re/blanket libthr
* note to self: do not confuse void* with int.mtm2003-05-231-1/+1
| | | | Approved by: re/blanket libthr
* When a thread exits it does not return from the kernel unless itmtm2003-05-211-0/+4
| | | | | | | is the *only* remaining thread in the application, in which case we should not core dump, and instead exit gracefully. Approved by: markm/mentor, re/blanket libthr
* - Define curthread as _get_curthread() and remove all direct calls tojeff2003-04-021-3/+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/+186
adaptation of libc_r for the thr system call interface. This is beta quality code.
OpenPOWER on IntegriCloud