diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-09-10 11:40:36 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-09-10 11:41:24 -0700 |
commit | ea9a67f259d41952a990fc2b6224a36f87cb579a (patch) | |
tree | 05dd095f6bec9f9542e22a0fcd6e51f7f897b787 | |
parent | 01fdf7ca787ee0cc82a004c4c01fc714b23f4813 (diff) | |
download | syslinux-thread.tar.gz |
thread: mbox: fix return value for mbox_fetch()thread
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; } |