git.iko.soy/distributed-process
on master help sign in
Merge pull request #195 from haskell-distributed/strict-sendCtrlMsg

Make 'sendCtrlMsg' strict in the local case.

commita35cc217eaac9b86ea129ffc8ba171f8251de4a3 authorMathieu Boespflug <mboes@users.noreply.github.com> dateFri 12 Jun 2015, 19:21 (11 years ago) parent4e89b9d925ff92
1 file changed+6−2
src/Control/Distributed/Process/Internal/Messaging.hs+6−2
src/Control/Distributed/Process/Internal/Messaging.hs+6−2
@@ -177,7 +177,11 @@ _ `impliesDeathOf` _ =
177177 False
178178
179179
180−-- Send a control message
180+-- Send a control message. Evaluates the message to HNF before sending it.
181+--
182+-- The message shouldn't produce more errors when further evaluated. If
183+-- evaluation threw errors the node controller or the receiver would crash when
184+-- inspecting it.
181185sendCtrlMsg :: Maybe NodeId -- ^ Nothing for the local node
182186 -> ProcessSignal -- ^ Message to send
183187 -> Process ()
@@ -188,7 +192,7 @@ sendCtrlMsg mNid signal = do
188192 }
189193 case mNid of
190194 Nothing -> do
191− liftIO $ writeChan (localCtrlChan (processNode proc)) msg
195+ liftIO $ writeChan (localCtrlChan (processNode proc)) $! msg
192196 Just nid ->
193197 liftIO $ sendBinary (processNode proc)
194198 (ProcessIdentifier (processId proc))