From f6c0c6451825916ba1d9156bb350dc88b1fa0535 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 15 Dec 2009 07:20:41 -0500 Subject: [PATCH] threads, io.streams.c: cleanups --- basis/threads/threads.factor | 6 +++++- core/io/streams/c/c.factor | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/basis/threads/threads.factor b/basis/threads/threads.factor index af11d77f84..9d1cd29337 100644 --- a/basis/threads/threads.factor +++ b/basis/threads/threads.factor @@ -140,7 +140,11 @@ DEFER: next ! ! And if sleep-time outputs f, there are no sleeping ! threads either... so WTF. - sleep-time [ die 0 ] unless* (sleep) next ; + sleep-time { + { [ dup not ] [ drop die ] } + { [ dup 0 = ] [ drop ] } + [ (sleep) ] + } cond next ; : (next) ( arg thread -- * ) f >>state diff --git a/core/io/streams/c/c.factor b/core/io/streams/c/c.factor index 1da30fe922..cb978d5deb 100644 --- a/core/io/streams/c/c.factor +++ b/core/io/streams/c/c.factor @@ -73,7 +73,8 @@ M: c-io-backend init-io ; M: c-io-backend init-stdio init-c-stdio ; -M: c-io-backend io-multiplex 60 60 * 1000 * 1000 * or (sleep) ; +M: c-io-backend io-multiplex + dup 0 = [ drop ] [ 60 60 * 1000 * 1000 * or (sleep) ] if ; : fopen ( path mode -- alien ) [ utf8 string>alien ] bi@ (fopen) ;