diff options
-rw-r--r-- | ioq.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -46,8 +46,14 @@ bool mog_ioq_ready(struct mog_ioq *ioq, struct mog_fd *client_mfd) CHECK(int, 0, pthread_mutex_lock(&ioq->mtx)); good = ioq->cur > 0; - if (good) { /* uncontended case is simple */ - ioq->cur--; + if (good) { + /* + * assume the worst when we are the last one to + * acquire a free slot + */ + if (--ioq->cur == 0) + ioq_set_contended(ioq); + mog_ioq_current = ioq; } else { client_mfd->ioq_blocked = 1; |