summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/internal/pthread_impl.h3
-rw-r--r--src/thread/pthread_create.c1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h
index 1322a6a8..de2b9d8b 100644
--- a/src/internal/pthread_impl.h
+++ b/src/internal/pthread_impl.h
@@ -68,7 +68,8 @@ struct pthread {
};
enum {
- DT_EXITING = 0,
+ DT_EXITED = 0,
+ DT_EXITING,
DT_JOINABLE,
DT_DETACHED,
};
diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c
index 250cd0a4..6f187ee8 100644
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -156,6 +156,7 @@ _Noreturn void __pthread_exit(void *result)
}
/* Wake any joiner. */
+ a_store(&self->detach_state, DT_EXITED);
__wake(&self->detach_state, 1, 1);
/* After the kernel thread exits, its tid may be reused. Clear it