Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions kernel/include/ksched.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ void z_ready_thread(struct k_thread *thread);
void z_requeue_current(struct k_thread *curr);
struct k_thread *z_swap_next_thread(void);
void z_thread_abort(struct k_thread *thread);
void z_thread_wake_joiners(struct k_thread *thread);

static inline void z_pend_curr_unlocked(_wait_q_t *wait_q, k_timeout_t timeout)
{
Expand Down
7 changes: 7 additions & 0 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,13 @@ static void end_thread(struct k_thread *thread)
}
}

void z_thread_wake_joiners(struct k_thread *thread)
{
LOCKED(&sched_spinlock) {
unpend_all(&thread->join_queue);
}
}

void z_thread_abort(struct k_thread *thread)
{
k_spinlock_key_t key = k_spin_lock(&sched_spinlock);
Expand Down
9 changes: 4 additions & 5 deletions lib/posix/posix_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define ZEPHYR_LIB_POSIX_POSIX_INTERNAL_H_

#include <zephyr/kernel.h>
#include <zephyr/sys/atomic.h>

/*
* Bit used to mark a pthread object as initialized. Initialization status is
Expand All @@ -31,14 +32,15 @@ enum pthread_state {
PTHREAD_DETACHED = PTHREAD_CREATE_DETACHED,
/* The thread is running and joinable. */
PTHREAD_JOINABLE = PTHREAD_CREATE_JOINABLE,
/* A joinable thread exited and its return code is available. */
PTHREAD_EXITED,
/* The thread structure is unallocated and available for reuse. */
PTHREAD_TERMINATED,
/* A joinable thread exited and its return code is available. */
PTHREAD_EXITED
};

struct posix_thread {
struct k_thread thread;
struct k_spinlock lock;

/* List of keys that thread has called pthread_setspecific() on */
sys_slist_t key_list;
Expand All @@ -49,12 +51,9 @@ struct posix_thread {
/* Pthread cancellation */
int cancel_state;
int cancel_pending;
struct k_spinlock cancel_lock;

/* Pthread State */
enum pthread_state state;
pthread_mutex_t state_lock;
pthread_cond_t state_cond;
};

typedef struct pthread_key_obj {
Expand Down
Loading