Skip to content

Commit

Permalink
fixed bug with recursive mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
sberkun committed Feb 22, 2024
1 parent 2d5f710 commit dcbcc16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/platform/lf_rp2040_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,9 @@ int lf_cond_signal(lf_cond_t* cond) {
}

int lf_cond_wait(lf_cond_t* cond) {
mutex_exit(cond->mutex);
lf_mutex_unlock(cond->mutex);
sem_acquire_blocking(&(cond->sema));
mutex_enter_blocking(cond->mutex);
lf_mutex_lock(cond->mutex);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions include/core/platform/lf_rp2040_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
#ifndef LF_SINGLE_THREADED
#warning "Threaded support on rp2040 is still experimental"

typedef mutex_t lf_mutex_t;
typedef recursive_mutex_t lf_mutex_t;
typedef struct {
semaphore_t sema;
mutex_t* mutex;
lf_mutex_t* mutex;
} lf_cond_t;
typedef int lf_thread_t;

Expand Down

0 comments on commit dcbcc16

Please sign in to comment.