diff --git a/include/ardix/mutex.h b/include/ardix/mutex.h index 7e621b9..6238876 100644 --- a/include/ardix/mutex.h +++ b/include/ardix/mutex.h @@ -97,11 +97,7 @@ extern void _mutex_unlock(uint8_t *lock); * * @param mutex Mutex to initialize */ -__always_inline void mutex_init(struct mutex *mutex) -{ - mutex->lock = 0; - list_init(&mutex->wait_queue); -} +void mutex_init(struct mutex *mutex); /** * @brief Acquire an exclusive lock on a mutex. diff --git a/kernel/mutex.c b/kernel/mutex.c index 300e429..ead5f59 100644 --- a/kernel/mutex.c +++ b/kernel/mutex.c @@ -10,6 +10,13 @@ #include #include +void mutex_init(struct mutex *mutex) +{ + mutex->lock = 0; + spin_init(&mutex->wait_queue_lock); + list_init(&mutex->wait_queue); +} + void mutex_lock(struct mutex *mutex) { if (mutex_trylock(mutex) != 0) {