Skip to content

Commit 44527b4

Browse files
committed
fix compiler warning
1 parent b1ca434 commit 44527b4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/rp2_common/pico_async_context/async_context_threadsafe_background.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,14 @@ static void lock_release(async_context_threadsafe_background_t *self) {
138138
uint32_t async_context_threadsafe_background_execute_sync(async_context_t *self_base, uint32_t (*func)(void *param), void *param) {
139139
async_context_threadsafe_background_t *self = (async_context_threadsafe_background_t*)self_base;
140140
#if ASYNC_CONTEXT_THREADSAFE_BACKGROUND_MULTI_CORE
141-
const uint calling_core = get_core_num();
142-
if (self_base->core_num != calling_core) {
141+
if (self_base->core_num != get_core_num()) {
143142
// This core must not hold the lock mutex, or this cross-core execute would deadlock. It is fine if the other core holds it.
144143
// It would be a strange set of circumstances for it to do so, hence the hard_assert
145144

146145
// Note that this read of the owner is not synchronized with the other core; however we only
147146
// care about it being set to `calling_core`, which the other core will not transition
148147
// it either from or to.
149-
hard_assert(recursive_mutex_owner(&self->lock_mutex) != calling_core);
148+
hard_assert(recursive_mutex_owner(&self->lock_mutex) != lock_get_caller_owner_id());
150149
sync_func_call_t call = {0};
151150
call.worker.do_work = handle_sync_func_call;
152151
call.func = func;

0 commit comments

Comments
 (0)