[Haskell-cafe] Threading and FFI

Yves Parès limestrael at gmail.com
Tue Feb 16 13:25:58 EST 2010


Well I tried both 'unsafe' and 'safe', and actually I saw no difference...
Even with 'safe', I see a huge difference between calling a C function which
sleeps and another which doesn't. When there is a sleep, the other thread is
really slower (it just prints numbers, and I look at which pace they're
displayed).


Felipe Lessa wrote:
> 
> On Tue, Feb 16, 2010 at 09:00:08AM -0800, Yves Parès wrote:
>> I was wondering: is the Haskell default runtime (that which uses only one
>> processor) scheduler able to interrupt a thread which is currently
>> calling
>> to a C function in order to enable another haskell thread to progress?
>> I think it can't, because I have starvation problems when I have a thread
>> which calls inside its loop to a C function which makes a little "sleep".
> 
> Did you try marking the call as safe?
> 
> Cheers,
> 
> --
> Felipe.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 


-----
Yves Parès

Live long and prosper
-- 
View this message in context: http://old.nabble.com/Threading-and-FFI-tp27611528p27612884.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list