Skip to content

Commit

Permalink
using yield
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Jun 11, 2024
1 parent 29f4e61 commit 107486a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Network/Socket/Shutdown.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Network.Socket.Shutdown (
import qualified Control.Exception as E
import Foreign.Marshal.Alloc (mallocBytes, free)

import Control.Concurrent (threadDelay)
import Control.Concurrent (threadDelay, yield)

import Network.Socket.Buffer
import Network.Socket.Imports
Expand Down Expand Up @@ -55,6 +55,9 @@ gracefulClose s tmout0 = sendRecvFIN `E.finally` close s
case ex of
Left (E.SomeException _) -> return ()
Right () -> do
-- Giving CPU time to other threads hoping that
-- FIN arrives meanwhile.

This comment has been minimized.

Copy link
@KiranBudharapu

KiranBudharapu Jul 17, 2024

objective for end cycle

This comment has been minimized.

Copy link
@kazu-yamamoto

kazu-yamamoto Jul 17, 2024

Author Collaborator

I don't understand.
Would you explain it more concretely?

yield
-- Waiting TCP FIN.
E.bracket (mallocBytes bufSize) free recvEOFloop
recvEOFloop buf = loop 1 0
Expand Down

0 comments on commit 107486a

Please sign in to comment.