mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Make more improvements to threading support
- fix rare thread exit race condition on openbsd - pthread_getattr_np() now supplies detached status - child threads may now pthread_join() the main thread - introduce sigandset(), sigorset(), and sigisemptyset() - introduce pthread_cleanup_push() and pthread_cleanup_pop()
This commit is contained in:
parent
38df0a4186
commit
4a6fd3d910
52 changed files with 586 additions and 241 deletions
|
@ -24,14 +24,16 @@
|
|||
/**
|
||||
* Waits for thread to terminate.
|
||||
*
|
||||
* @param value_ptr if non-null will receive pthread_exit() argument
|
||||
* @return 0 on success, or errno with error
|
||||
* @raise EDEADLK if thread is detached
|
||||
* @raise EDEADLK if `thread` is the current thread
|
||||
* @raise EINVAL if `thread` is detached
|
||||
* @returnserrno
|
||||
* @threadsafe
|
||||
*/
|
||||
int pthread_join(pthread_t thread, void **value_ptr) {
|
||||
struct PosixThread *pt;
|
||||
if (thread == pthread_self()) {
|
||||
if (thread == __get_tls()->tib_pthread) {
|
||||
return EDEADLK;
|
||||
}
|
||||
if (!(pt = (struct PosixThread *)thread) || //
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue