wolfgang.thaller at gmx.net
Fri Feb 28 14:46:13 EST 2003
Sven Panne wrote:
> Just to make sure I have understood everything correctly: To make
> HOpenGL work in the presence of a threaded RTS, the only places which
> need a change are the stub factories for GLUT callbacks, where a
> attribute is required now.
> What about the foreign import of glutMainLoop (the main native
> for GLUT, which calls the Haskell callbacks mentioned above when an
> occurs and blocks the rest of the time)? It is currently "safe", is
> OK? Or should it be "threadsafe"?
It should probably be "threadsafe", just in case somebody wants to do
some (non-OpenGL) work in the background.
> I must admit that I can't remember the
> exact semantic distinction between those two attributes anymore... :-}
The problem is, nobody does... the original implementation didn't work
in all cases. The original implementation made "safe" calls block all
other haskell threads in some cases, and crashed in other cases.
"Threadsafe" means that calling the foreign import shouldn't block or
otherwise disturb other haskell threads. "Safe" means... well... almost
nobody seems to know, and still fewer people agree on it.
In the current "HEAD", there is no difference between threadsafe and
safe. If someone comes up with a clear specification of why and how
"safe" should be different from threadsafe, things might change again.
This issue is (I think/hope) entirely orthogonal to the Bound Threads
More information about the FFI