@@ -16,10 +16,13 @@ data PID : Type where
16 MkPID : (pid : Ptr) -> PID
16 MkPID : (pid : Ptr) -> PID
18||| Spawn a process in a new thread, returning the process ID
18||| Spawn a process in a new thread, returning the process ID
19+||| Returns `Nothing` if there are not enough resources to create the new thread
20−spawn : (process : IO ()) -> IO PID
21+spawn : (process : IO ()) -> IO (Maybe PID)
21spawn proc = do pid <- fork proc
22spawn proc = do pid <- fork proc
22− pure (MkPID pid)
25+ else pure (Just (MkPID pid))
24||| Create a channel which connects this process to another process
27||| Create a channel which connects this process to another process