Newsgroups: comp.lang.modula3
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!decwrl!pa.dec.com!src.dec.com!kalsow 
From: kalsow (Bill Kalsow)
Subject: Re: 1.6 bugs
In-Reply-To: Message of Mon, 8 Apr 1991 12:50:15 +0100
    from Peter.Robinson@computer-lab.cambridge.ac.uk
    <Mon.Apr..8.12:45:48.1991.@NewBrightonBelle:ComputerLab:CambridgeUniv>
To: m3
Message-ID: <9104081744.AA05342@jumbo.pa.dec.com>
Cc: kalsow, Peter.Robinson@computer-lab.cambridge.ac.uk, m3
Date: Mon,  8 Apr 91 10:43:47 PDT
Lines: 33

Sure enough, the scheduler's polling loop wasn't checking for alerts
in the threads that were blocked in I/O or timers.

Fix: system/corelib/thread/Thread.m3, in Thread.Yield, lines 332 - 387

   change:

      CASE t.state OF 
        | State.pausing  => 
            <<< case body 1 >>>
        | State.blocking =>
            <<< case body 2 >>>
        ELSE (* do nothing, these are not interesting *) END;

   to:

      CASE t.state OF 
        | State.pausing  => 
            IF (t.alertable) AND (t.alertPending) THEN
              CanRun (t);
            ELSE
              <<< case body 1 >>>
            END;
        | State.blocking =>
            IF (t.alertable) AND (t.alertPending) THEN
              CanRun (t);
            ELSE
              <<< case body 2 >>>
            END;
        ELSE (* do nothing, these are not interesting *) END;


  - Bill Kalsow
