@@ -14,7 +14,7 @@ module Kore.JsonRpc.Server (
14
14
JsonRpcHandler (.. ),
15
15
) where
16
16
17
- import Control.Concurrent (forkIO , forkOS , throwTo )
17
+ import Control.Concurrent (forkIO , runInBoundThread , throwTo )
18
18
import Control.Concurrent.STM.TChan (newTChan , readTChan , writeTChan )
19
19
import Control.Exception (Exception (fromException ), catch , mask , throw )
20
20
import Control.Monad (forever )
@@ -135,7 +135,10 @@ srv runBound respond handlers = do
135
135
sendResponses r = Log. runNoLoggingT $ flip runReaderT rpcSession $ sendBatchResponse r
136
136
137
137
respondTo :: Request -> IO (Maybe Response )
138
- respondTo req = buildResponse (respond req) req
138
+ respondTo req
139
+ | runBound = runInBoundThread $ buildResponse (respond req) req
140
+ | otherwise = buildResponse (respond req) req
141
+ -- workers should run in bound threads (to secure foreign calls) when flagged
139
142
140
143
cancelReq :: ErrorObj -> BatchRequest -> IO ()
141
144
cancelReq err = \ case
@@ -174,8 +177,7 @@ srv runBound respond handlers = do
174
177
restore (thing a) `catch` catchesHandler a
175
178
176
179
liftIO $
177
- -- workers should run in bound threads (to secure foreign calls) when flagged
178
- (if runBound then forkOS else forkIO) $
180
+ forkIO $
179
181
forever $
180
182
bracketOnReqException
181
183
(atomically $ readTChan reqQueue)
0 commit comments