summaryrefslogtreecommitdiffstats
path: root/otherlibs/threads/scheduler.c
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/threads/scheduler.c')
-rw-r--r--otherlibs/threads/scheduler.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/otherlibs/threads/scheduler.c b/otherlibs/threads/scheduler.c
index ba01f9137..b1620580d 100644
--- a/otherlibs/threads/scheduler.c
+++ b/otherlibs/threads/scheduler.c
@@ -410,7 +410,11 @@ value thread_outchan_ready(chan, vsize) /* ML */
if (size < 0) {
return Val_bool(chan->curr == chan->buff);
} else {
- return Val_bool(chan->curr + size <= chan->end);
+ int free = chan->end - chan->curr;
+ if (chan->curr == chan->buff)
+ return Val_bool(size < free);
+ else
+ return Val_bool(size <= free);
}
}