logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

RE: Threaded RTS: msg#00210

Subject: RE: Threaded RTS
On the subject of safe vs. threadsafe, the last bit of the discussion
was:

> > As for whether we should have safe==threadsafe, I suspect 
> > that might not
> > be a good idea if you want to bind to a library which isn't
> > OS-thread-safe.
> 
> I still disagree:
> a) If people want to serialize access to a foreign library, 
> they should use MVars.
> b) The FFI document doesn't guarantee that "safe" blocks, anyway. 
> That's an implementation detail.

Strictly speaking, Haskell 98 + FFI doesn't have concurrency, so "safe"
does implicitly block.

> c) People have been suprised by the behaviour of "safe" calls in the 
> past, and they will be surprised by it in the future, because 
> for some 
> reason, "safe" is the default and not "threadsafe". Why not make the 
> safest option the default?

I think originally the idea was that we should provide for accessing
foreign libraries which aren't thread-safe by default.  By making
safe==threadsafe, we alter the policy in favour of thread-safe
libraries, requiring the programmer to implement explicit serialisation
for any foreign libraries that aren't thread-safe.  I don't have any
objections to this, since the world is moving in a direction of general
thread-safety anwyay, and there are known implementation difficulties
with "safe".

Cheers,
        Simon


<Prev in Thread] Current Thread [Next in Thread>