Native Threads in the RTS
29 Nov 2002 13:38:05 +0000
> Another problem, from an implementation point of view, is that we
> would have to surround "unsafe" foreign calls with a lot of
> context-switching gumph, in case the calling Haskell thread is bound
> to a native thread. I really think we don't want to do this.
Note that you only have to do this to foreign calls of the form:
foreign import bound foo :: ...
since any other calls are free to use whatever thread they feel like.
So, we can say that foreign functions of the form:
foreign import bound unsafe bar :: ...
are illegal or we can allow them and provide warnings or we can allow
them and trust the programmer to know that bar is much more expensive
than they think. (I favour the first two.)