This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mtype = { PING , PONG , INFO } ; | |
typedef Node { | |
chan inChan = [50] of {mtype } ; | |
bool receivedInfo; | |
}; | |
Node nodes[2]; | |
active proctype Master() { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mtype = { FISH , RESCHEDULE , SCHEDULE , SCHEDULEREQ , SCHEDULEAUTH , ACK , NOWORK , SENDFAILED , PING } ; // message payload types | |
mtype = { ONNODE , INTRANSITION }; // spark.status types | |
typedef Node { | |
chan inChan = [50] of {mtype, chan } ; | |
bool hasSpark; | |
bool waitingFish; | |
bool waitingSchedAuth; | |
bool dead; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DeriveDataTypeable #-} | |
import Control.Concurrent (threadDelay) | |
import Control.Exception (Exception,throw) | |
import Control.Monad (void) | |
import Control.Concurrent.Async (Async,race,wait,withAsync) | |
import Data.Typeable (Typeable) | |
data ThreadTimeoutException = ThreadTimeoutException | |
deriving (Show, Typeable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prelude> data D = D Int | |
Prelude> let f (D i) = "ok" | |
Prelude> f undefined | |
"*** Exception: Prelude.undefined | |
Prelude> newtype D = D Int | |
Prelude> let f (D i) = "ok" | |
Prelude> f undefined | |
"ok" |
NewerOlder