if your computation in the C call takes more than 400 nano seconds, the overhead of the safe ffi convention is less onerous and you should do that when applicable.
an alternative is so use forkOn to setup a worker thread on various GHC capabilities, and have them in parallel work on different chunks of the list. that way you're pausing ALL the capabilities (which again, you should only use the unsafe ffi convention for computations that take <= 10 microseconds if you want things to be well behaved) On Thu, Aug 14, 2014 at 12:21 PM, Donn Cave <d...@avvanta.com> wrote: > I'm no judge of what's true about safe and unsafe, but this account of > the system has at least to my ear the ring of authenticity: > > > http://blog.melding-monads.com/2011/10/24/concurrency-and-foreign-functions-in-the-glasgow-haskell-compiler/ > > The FFI section is short and readable. > > With respect to whether "unsafe" does or does not block other threads, > I can never penetrate the verbiage about capabilities to know for sure > what to expect in practice, but when I checked, in practice, "unsafe" > blocks other threads. I use "safe" to avoid this. > > Donn > _______________________________________________ > Glasgow-haskell-users mailing list > Glasgow-haskell-users@haskell.org > http://www.haskell.org/mailman/listinfo/glasgow-haskell-users >
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users