[Haskell-cafe] Why do "unsafe" foreign calls block other threads?

Evan Laforge qdunkan at gmail.com
Tue Aug 3 18:33:00 EDT 2010

>> Just think of "unsafe" in relation to "unsafeIndex" or something.
>> It's faster, but you have to be sure the index is in bounds.
> Yes, but the whole reason to use "unsafe" is to get higher performance
> at the cost of safety.  If the result of calling an "unsafe" foreign
> function is that you *lose* performance because the other threads have
> to be halted first, then this seems to defeat the whole point of marking
> a call as "unsafe" in the first place.

That's why the function has to return soon and shouldn't do a lot of work.

More information about the Haskell-Cafe mailing list