FFI, safe vs unsafe

John Meacham john at repetae.net
Wed Apr 12 19:03:08 EDT 2006


On Thu, Apr 13, 2006 at 12:43:26AM +0200, Marcin 'Qrczak' Kowalczyk wrote:
> What about getaddrinfo()? It doesn't synchronize with the rest of the
> program, it will eventually complete no matter whether other threads
> make progress, so making it concurrent is not necessary for correctness.
> It should be made concurrent nevertheless because it might take a long
> time. It does block; if it didn't block but needed the same time for
> an internal computation which doesn't go back to Haskell, it would
> still benefit from making the call concurrent.

getaddrinfo most definitly blocks so should be made concurrent, it uses
sockets internally. The progress guarentee is meant to imply "if
something can effectivly use the CPU it will be given it if nothing else
is using it" not that it will just eventually complete. Performing a
long calculation is progress whether in haskell or C, waiting on a file
descriptor isn't.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell-prime mailing list