Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c
- index 49f2f72..92191ca 100644
- --- a/src/thread/pthread_create.c
- +++ b/src/thread/pthread_create.c
- @@ -132,8 +132,11 @@ static int start(void *p)
- {
- pthread_t self = p;
- if (self->startlock[0]) {
- - __wait(self->startlock, 0, 1, 1);
- - if (self->startlock[0]) {
- + if (self->startlock[0] == 1) {
- + __wait(self->startlock, 0, 1, 1);
- + }
- +
- + if (self->startlock[0] == 2) {
- self->detached = 2;
- pthread_exit(0);
- }
- @@ -295,7 +298,7 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att
- if (do_sched) {
- ret = __syscall(SYS_sched_setscheduler, new->tid,
- attr._a_policy, &attr._a_prio);
- - a_store(new->startlock, ret<0 ? 2 : 0);
- + a_store(new->startlock, ret<0 ? 2 : 3);
- __wake(new->startlock, 1, 1);
- if (ret < 0) return -ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement