X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FSelect.c;h=1666b499f526192f39d181cccd9dc1559ea0a533;hb=90a6918a3cb4901ecc64d810a6a4eb54d572c0bf;hp=d973e3ebecea779d6353e8ef1473c6bd41402524;hpb=b32b2d43b67c42f45105df40ae8af42eeb58078f;p=ghc-hetmet.git diff --git a/ghc/rts/Select.c b/ghc/rts/Select.c index d973e3e..1666b49 100644 --- a/ghc/rts/Select.c +++ b/ghc/rts/Select.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Select.c,v 1.9 2000/03/16 17:24:08 simonmar Exp $ + * $Id: Select.c,v 1.10 2000/03/20 09:42:50 andy Exp $ * * (c) The GHC Team 1995-1999 * @@ -105,8 +105,18 @@ awaitEvent(rtsBool wait) case BlockedOnDelay: { - if (tso->block_info.delay < min) - min = tso->block_info.delay; + int candidate; /* signed int is intentional */ +#if defined(HAVE_SETITIMER) + candidate = tso->block_info.delay; +#else + candidate = tso->block_info.target - getourtimeofday(); + if (candidate < 0) { + candidate = 0; + } +#endif + if ((nat)candidate < min) { + min = candidate; + } continue; } @@ -207,14 +217,29 @@ awaitEvent(rtsBool wait) break; case BlockedOnDelay: - if (tso->block_info.delay > delta) { - tso->block_info.delay -= delta; - ready = 0; - } else { - tso->block_info.delay = 0; - ready = 1; + { + int candidate; /* signed int is intentional */ +#if defined(HAVE_SETITIMER) + if (tso->block_info.delay > delta) { + tso->block_info.delay -= delta; + ready = 0; + } else { + tso->block_info.delay = 0; + ready = 1; + } +#else + candidate = tso->block_info.target - getourtimeofday(); + if (candidate < 0) { + candidate = 0; + } + if ((nat)candidate > delta) { + ready = 0; + } else { + ready = 1; + } +#endif + break; } - break; default: barf("awaitEvent");