From f3e03796652b792bb3fd5d3d25b687b9a7f14633 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Fri, 18 May 2012 11:25:25 +0200 Subject: A bit of a change in the directory layout. --- src/kernel/lib/sched.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/kernel/lib/sched.h (limited to 'src/kernel/lib/sched.h') diff --git a/src/kernel/lib/sched.h b/src/kernel/lib/sched.h new file mode 100644 index 0000000..1fe148d --- /dev/null +++ b/src/kernel/lib/sched.h @@ -0,0 +1,24 @@ +#ifndef DEF_MUTEX_H +#define DEF_MUTEX_H + +#include + +#define MUTEX_LOCKED 1 +#define MUTEX_UNLOCKED 0 + +//A mutex is just an uint32_t +typedef uint32_t mutex_t; + +#ifdef __cplusplus +extern "C" { +#endif + +int mutex_lock(mutex_t* mutex); //wait for mutex to be free +int mutex_lockE(mutex_t* mutex); //lock mutex only if free, returns !0 if locked, 0 if was busy +void mutex_unlock(mutex_t* mutex); + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.2.3