Changeset 14544 for src/Pugs/Prim.hs

Show
Ignore:
Timestamp:
10/29/06 17:07:40 (2 years ago)
Author:
audreyt
Message:

* Pugs.Prim: async{...} should use user-level threads by

default; system-level threads are to be created via some
other mechanism.

* Pugs.Prim: Allow sleep for fractional seconds.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Prim.hs

    r14537 r14544  
    402402    guardIO $ fmap VStr (readSymbolicLink str) 
    403403op1 "sleep" = \v -> do 
    404     x <- fromVal v 
     404    x <- fromVal v :: Eval VNum 
    405405    guardIO $ do 
    406406        TOD t0s t0ps <- getClockTime 
    407         threadDelay (x * clocksPerSecond) 
     407        threadDelay (round $ x * clocksPerSecond) 
    408408        TOD t1s t1ps <- getClockTime 
    409409        return $ VRat ((fromInteger $ t1ps - t0ps) 
     
    540540    code    <- fromVal v 
    541541    lock    <- liftSTM $ newEmptyTMVar 
    542     tid     <- guardIO . (if rtsSupportsBoundThreads then forkOS else forkIO) $ do 
     542    tid     <- guardIO . forkIO $ do -- (if rtsSupportsBoundThreads then forkOS else forkIO) $ do 
    543543        val <- runEvalIO env $ do 
    544544            enterEvalContext CxtVoid $ App (Val code) Nothing []