[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] minios: add trydown
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1200580855 0 # Node ID a26aee4a152218ba9855f2766bfe6c3846b03074 # Parent 10101bc8181f5f97c641fffade3d1655cdd891fa minios: add trydown Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx> --- extras/mini-os/include/semaphore.h | 13 +++++++++++++ 1 files changed, 13 insertions(+) diff -r 10101bc8181f -r a26aee4a1522 extras/mini-os/include/semaphore.h --- a/extras/mini-os/include/semaphore.h Thu Jan 17 14:40:23 2008 +0000 +++ b/extras/mini-os/include/semaphore.h Thu Jan 17 14:40:55 2008 +0000 @@ -49,6 +49,19 @@ static inline void init_SEMAPHORE(struct #define init_MUTEX(sem) init_SEMAPHORE(sem, 1) +static inline int trydown(struct semaphore *sem) +{ + unsigned long flags; + int ret = 0; + local_irq_save(flags); + if (sem->count > 0) { + ret = 1; + sem->count--; + } + local_irq_restore(flags); + return ret; +} + static void inline down(struct semaphore *sem) { unsigned long flags; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |