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 <cfriedt@meta.com>
This commit is contained in:
Chris Friedt 2022-11-11 06:59:02 -05:00 committed by Stephanos Ioannidis
parent 1777a33558
commit afae448ff2

View file

@ -407,6 +407,8 @@ void pthread_exit(void *retval)
pthread_mutex_unlock(&self->state_lock);
pthread_mutex_destroy(&self->state_lock);
pthread_cond_destroy(&self->state_cond);
k_thread_abort((k_tid_t)self);
}