diff --git a/sys/posix/pthread/pthread.c b/sys/posix/pthread/pthread.c
index b11ae629006481c49b80abed0b9095538a2a376a..222e341167f8a035c1019b8fb3e8c455a6e9128f 100644
--- a/sys/posix/pthread/pthread.c
+++ b/sys/posix/pthread/pthread.c
@@ -51,9 +51,10 @@ enum pthread_thread_status {
 };
 
 typedef struct pthread_thread {
+    int thread_pid;
+
     enum pthread_thread_status status;
     int joining_thread;
-    int thread_pid;
     void *returnval;
     bool should_cancel;
 
@@ -159,6 +160,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
 void pthread_exit(void *retval)
 {
     pthread_thread_t *self = pthread_sched_threads[pthread_self()];
+    self->thread_pid = -1;
     DEBUG("pthread_exit(%p), self == %p\n", retval, (void *) self);
     if (self->status != PTS_DETACHED) {
         self->returnval = retval;