mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 06:12:27 +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
|
@ -16,17 +16,17 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/nexgen32e/gc.internal.h"
|
||||
#include "libc/thread/tls.h"
|
||||
|
||||
void _pthread_ungarbage(void) {
|
||||
int i;
|
||||
struct Garbages *g;
|
||||
if ((g = __get_tls()->tib_garbages)) {
|
||||
// _pthread_exit() uses _gclongjmp() so if this assertion fails,
|
||||
// then the likely cause is the thread used gc() with longjmp().
|
||||
assert(!g->i);
|
||||
for (i = g->i; i--;) {
|
||||
((void (*)(intptr_t))g->p[i].fn)(g->p[i].arg);
|
||||
}
|
||||
free(g->p);
|
||||
free(g);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue