Skip to content

Commit

Permalink
Merge pull request #223 from lf-lang/zephyr-threads
Browse files Browse the repository at this point in the history
Zephyr fixes on thread creation and deletion
  • Loading branch information
lhstrh authored May 26, 2023
2 parents 83b1cef + 37c94ec commit 98f1308
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion core/platform/lf_zephyr_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,15 @@ int lf_thread_create(lf_thread_t* thread, void *(*lf_thread) (void *), void* arg
(void *) lf_thread, arguments, NULL,
_LF_THREAD_PRIORITY, 0, K_NO_WAIT);


// Pass the pointer to the k_thread struct out. This is needed
// to join on the thread later.
*thread = &threads[tid];

// Increment the tid counter so that next call to `lf_thread_create`
// uses the next available k_thread struct and stack.
tid++;

*thread = my_tid;

k_mutex_unlock(&thread_mutex);

Expand Down
2 changes: 1 addition & 1 deletion include/core/platform/lf_zephyr_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ typedef struct {
lf_mutex_t* mutex;
struct k_condvar condition;
} lf_cond_t;
typedef k_tid_t lf_thread_t;
typedef struct k_thread* lf_thread_t;

extern lf_mutex_t mutex;
extern lf_cond_t event_q_changed;
Expand Down

0 comments on commit 98f1308

Please sign in to comment.