PreviousUpNext

15.4.1186  src/lib/std/src/socket/win32-nonblocking-socket-junk.pkg

## win32-nonblocking-socket-junk.pkg
## Author: Matthias Blume (blume@tti-c.org)



#   Check for would-block error condition on WinSockets.




package nonblocking_socket_junk:  api
    my mkIODesc:  Int -> PreOS::io::Io_Descriptor
    my wrapNB_o:  (X -> Y  ) -> (X ->  Null_Or(Y) )
    my wrapNB_b:  (X -> Void) -> (X -> Bool)
end
{
    mkIODesc = PreOS::io::SockDesc

    # This is a placeholder for a correct implementation that actually
    # checks the error condition...
    fun blockErr (winix_guts::RUNTIME_EXCEPTION _) = TRUE
      | blockErr _ = FALSE

    fun wrapNB_o f x = THE (f x)
        except ex => if blockErr ex then NULL else raise exception ex

    fun wrapNB_b f x = (f x; TRUE)
        except ex => if blockErr ex then FALSE else raise exception ex
};


## Copyright (c) 2003 by The Fellowship of SML/NJ
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2012,
## released under Gnu Public Licence version 3.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext