On 14 December 2005 18:04, Bulat Ziganshin wrote: > Hello Simon, > > Wednesday, December 14, 2005, 7:39:43 PM, you wrote: > >> Do other Haskell threads get blocked during an FFI call? > >> | safe unsafe >> --------------+---------------- >> -threaded | NO YES >> no -threaded | YES YES > > there is also `threadsafe` specifier. i don't understand from the docs > what it exactly means? > > ghc commentary says: > > To signal that you want an external call to be serviced by a separate > OS thread, you have to add the attribute threadsafe to a foreign > import declaration, i.e., > > foreign import "bigComp" threadsafe largeComputation :: Int -> IO () > > The distinction between 'safe' and thread-safe C calls is made so that > we may call external functions that aren't re-entrant but may cause a > GC to occur. > > The threadsafe attribute subsumes safe.
threadsafe is deprecated; it is currently exactly the same as safe. We thought at one time that it would be useful to have the distinction, but it turned out to be impractical to implement safe that wasn't also threadsafe. Cheers, Simon _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe