socket-0.5.3.0: A portable and extensible sockets library.

Safe HaskellNone
LanguageHaskell2010

System.Socket.Unsafe

Contents

Synopsis

unsafeSend

unsafeSendTo

unsafeReceive

unsafeReceiveFrom

Socket Options

unsafeGetSocketOption

unsafeSetSocketOption

unsafeSetSocketOption :: Storable a => Socket f t p -> CInt -> CInt -> a -> IO () Source

Waiting For Events

unsafeSocketWaitRead

unsafeSocketWaitRead Source

Arguments

:: Fd

Socket descriptor

-> Int

How many times has it been tried unsuccessfully so far? (currently only relevant on Windows)

-> IO (IO ())

The outer action registers the waiting, the inner does the actual wait.

Blocks until a socket should be tried for reading.

safeSocketWaitRead = do
  wait <- withMVar msock $ \sock-> do
    -- Register while holding a lock on the socket descriptor.
    unsafeSocketWaitRead sock 0 
  -- Do the waiting without keeping the socket descriptor locked.
  wait

unsafeSocketWaitWrite

Other Helpers

tryWaitRetryLoop

tryWaitRetryLoop :: Socket f t p -> (Fd -> Int -> IO (IO ())) -> (Fd -> IO CInt) -> IO CInt Source