From: simonmar Date: Wed, 24 Nov 1999 16:39:33 +0000 (+0000) Subject: [project @ 1999-11-24 16:39:33 by simonmar] X-Git-Tag: Approximately_9120_patches~5497 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=fc03cfda1acf4a11fe24968a2df6a7fd8528d017;p=ghc-hetmet.git [project @ 1999-11-24 16:39:33 by simonmar] Fix bug in threadDelay, where the delay ticks could end up negative. --- diff --git a/ghc/rts/Select.c b/ghc/rts/Select.c index ffbc7fb..dcd9f62 100644 --- a/ghc/rts/Select.c +++ b/ghc/rts/Select.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Select.c,v 1.4 1999/11/03 15:04:25 simonmar Exp $ + * $Id: Select.c,v 1.5 1999/11/24 16:39:33 simonmar Exp $ * * (c) The GHC Team 1995-1999 * @@ -49,7 +49,8 @@ awaitEvent(rtsBool wait) StgTSO *tso, *prev, *next; rtsBool ready; fd_set rfd,wfd; - int min, numFound, delta; + int numFound; + nat min, delta; int maxfd = -1; struct timeval tv; @@ -200,8 +201,13 @@ awaitEvent(rtsBool wait) break; case BlockedOnDelay: - tso->block_info.delay -= delta; - ready = (tso->block_info.delay <= 0); + if (tso->block_info.delay > delta) { + tso->block_info.delay -= delta; + ready = 0; + } else { + tso->block_info.delay = 0; + ready = 1; + } break; default: