Fix assertion error in pthread_create()

This commit is contained in:
Justine Tunney 2024-01-22 07:10:12 -08:00
parent 51cd83f674
commit 8ebe2e9020
No known key found for this signature in database
GPG key ID: BE714B4575D6E328

View file

@ -175,6 +175,7 @@ static errno_t pthread_create_impl(pthread_t *thread,
errno = e; errno = e;
return EAGAIN; return EAGAIN;
} }
dll_init(&pt->list);
pt->pt_start = start_routine; pt->pt_start = start_routine;
pt->pt_arg = arg; pt->pt_arg = arg;
@ -289,7 +290,6 @@ static errno_t pthread_create_impl(pthread_t *thread,
// add thread to global list // add thread to global list
// we add it to the beginning since zombies go at the end // we add it to the beginning since zombies go at the end
dll_init(&pt->list);
_pthread_lock(); _pthread_lock();
dll_make_first(&_pthread_list, &pt->list); dll_make_first(&_pthread_list, &pt->list);
_pthread_unlock(); _pthread_unlock();