
I fear that it's not unfrequent, for an IT company, to have to implement systems wich monitor some sort of hardware. It might happen that the hardware has a driver/library tightly coupled with it, written in C. Often, this library will have an event queue, but it could happen that the library has been designed to run in a sort of "mainloop", because it has to send impulses (sort of) to the hardware to let it do a continuous job, with hooks (callbacks) for an eventual UI. Well, in this case, suppose that a customer comes to you and ask an hardware monitor with a GUI. This case is easily rephrased as: make an opengl window and a CGA window run together, each one with its main loop, and manage both from haskell, without directly accessing the opengl event queue (if there is any directly accessible, I don't know). [this has no connection between opengl being a graphics library. An opengl window is just considered as a source of events] Now, if threadsafe exists, there are (if I have understood well what threadsafe is, someone please confirm it to me) zero issues. You run the opengl mainloop as a separate OS thread, and send the results back to haskell. If threadsafe does not exist, what are the alternatives? Would them easily be handled by a clever design of CGA? What sort of design? Can threads be spawned in C and then be used in haskell? Would this be a mess instead? Again, I can do anything more than asking question on this subject, and sorry for the confusion :) Vincenzo