[syslinux:lwip] core: thread: add static declaration of semaphores

syslinux-bot for H. Peter Anvin hpa at zytor.com
Fri Apr 22 20:05:07 PDT 2011


Commit-ID:  83d03ef60fe5cdb7083e12e18b2ac83c567c29d5
Gitweb:     http://syslinux.zytor.com/commit/83d03ef60fe5cdb7083e12e18b2ac83c567c29d5
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Mon, 14 Sep 2009 21:34:57 -0700
Committer:  Eric W. Biederman <ebiederm at xmission.com>
CommitDate: Sat, 9 Apr 2011 18:27:06 -0700

core: thread: add static declaration of semaphores

Add the ability to statically declare initialized semaphores.

Signed-off-by: Eric W. Biederman <ebiederm at xmission.com>


---
 core/include/thread.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/core/include/thread.h b/core/include/thread.h
index 7d34676..e82a80b 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);



More information about the Syslinux-commits mailing list