aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-09-14 21:34:57 -0700
committerEric W. Biederman <ebiederm@xmission.com>2011-04-09 18:27:06 -0700
commit83d03ef60fe5cdb7083e12e18b2ac83c567c29d5 (patch)
tree967c7b059ef7dc4e73a50574b00a31752997dd56 /core
parentcd8b37053cc36014379fefdecf1d409bc7dc5b45 (diff)
downloadsyslinux-83d03ef60fe5cdb7083e12e18b2ac83c567c29d5.tar.gz
syslinux-83d03ef60fe5cdb7083e12e18b2ac83c567c29d5.tar.xz
syslinux-83d03ef60fe5cdb7083e12e18b2ac83c567c29d5.zip
core: thread: add static declaration of semaphores
Add the ability to statically declare initialized semaphores. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'core')
-rw-r--r--core/include/thread.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/include/thread.h b/core/include/thread.h
index 7d346760..e82a80b2 100644
--- a/core/include/thread.h
+++ b/core/include/thread.h
@@ -46,6 +46,15 @@ struct semaphore {
struct thread_list list;
};
+#define DECLARE_INIT_SEMAPHORE(sem, cnt) \
+ struct semaphore sem = { \
+ .count = (cnt), \
+ .list = { \
+ .next = &sem.list, \
+ .prev = &sem.list \
+ } \
+ }
+
mstime_t sem_down(struct semaphore *, mstime_t);
void sem_up(struct semaphore *);
void sem_init(struct semaphore *, int);