diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-09-10 11:40:36 -0700 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2011-04-07 19:59:45 -0700 |
commit | 6739a210bbfb287c4716e049a37323b339f2fdde (patch) | |
tree | d3a8402e1bbd07a5e418e47f03ea661ccbf61d4a | |
parent | 8993d8a8940db2e603597589fc4bceceb0084a0d (diff) | |
download | syslinux-devel-lwip-devel-ebiederm.tar.gz syslinux-devel-lwip-devel-ebiederm.tar.xz syslinux-devel-lwip-devel-ebiederm.zip |
thread: mbox: fix return value for mbox_fetch()lwip-devel-ebiederm
Make mbox_fetch() actually return the time spent waiting.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | core/thread/mbox.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/thread/mbox.c b/core/thread/mbox.c index f880b47b..10e46ef7 100644 --- a/core/thread/mbox.c +++ b/core/thread/mbox.c @@ -38,9 +38,12 @@ int mbox_post(struct mailbox *mbox, void *msg, jiffies_t timeout) jiffies_t mbox_fetch(struct mailbox *mbox, void **msg, jiffies_t timeout) { - if (sem_down(&mbox->cons_sem, timeout) == (jiffies_t)-1) + jiffies_t t; + + t = sem_down(&mbox->cons_sem, timeout); + if (t == (jiffies_t)-1) return -1; - sem_down(&mbox->tail_sem, 0); + t += sem_down(&mbox->tail_sem, 0); if (msg) *msg = *mbox->tail; @@ -50,4 +53,5 @@ jiffies_t mbox_fetch(struct mailbox *mbox, void **msg, jiffies_t timeout) sem_up(&mbox->tail_sem); sem_up(&mbox->prod_sem); + return t; } |