Skip to content

Commit afae448

Browse files
cfriedtstephanosio
authored andcommitted
posix: pthread: take care with pthread cond resources
Previously, `pthread_cond_init()` could not actually fail, and destroying condition variables was a no-op, and it was missing in `pthread_exit()`. However, with the change of `pthread_cond_t` to `uint32_t`, and since those are embedded inside of `struct posix_thread` for the time being, the pthread code needs to keep track that it is relinquishes used condition variables when a thread completes. Signed-off-by: Chris Friedt <[email protected]>
1 parent 1777a33 commit afae448

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/posix/pthread.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,8 @@ void pthread_exit(void *retval)
407407
pthread_mutex_unlock(&self->state_lock);
408408
pthread_mutex_destroy(&self->state_lock);
409409

410+
pthread_cond_destroy(&self->state_cond);
411+
410412
k_thread_abort((k_tid_t)self);
411413
}
412414

0 commit comments

Comments
 (0)