From 114eedd764779bdc819b8942c4a24e8f13be78b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Wed, 5 Mar 2014 01:51:33 +0100 Subject: [PATCH] core:mutex: allow idle thread to use mutexes --- core/mutex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/mutex.c b/core/mutex.c index a79426ed1b..89e20fc596 100644 --- a/core/mutex.c +++ b/core/mutex.c @@ -45,7 +45,7 @@ int mutex_init(struct mutex_t *mutex) int mutex_trylock(struct mutex_t *mutex) { DEBUG("%s: trylocking to get mutex. val: %u\n", active_thread->name, mutex->val); - return (atomic_set_return(&mutex->val, thread_pid) == 0); + return (atomic_set_return(&mutex->val, 1) == 0); } int prio(void) @@ -72,7 +72,7 @@ void mutex_wait(struct mutex_t *mutex) if (mutex->val == 0) { /* somebody released the mutex. return. */ - mutex->val = thread_pid; + mutex->val = 1; DEBUG("%s: mutex_wait early out. %u\n", active_thread->name, mutex->val); restoreIRQ(irqstate); return;