Re: GTK and CinePaint

On Fri, 2004-04-09 at 06:13 +0000, Tor Lillqvist wrote:
> Even Java? I have imagined that Java, being so thread-friendly by
> design, would have tackled this issue "The Right Way" from the
> start. (Presumably by using an internal thread that actually does all
> the interaction with the Windows windowing, graphics and message pump
> API.)

An excellent question, to which the only definitive answer is to read
the Sun JVM source code (it's a free download). From a quick google
though, it seemst that the AWT runs its event loop in an implicitly
created thread which deals with event dispatch. I'm guessing therefore
that all window creation is marshalled into this thread, ie it uses a
variant of the server thread model.

I don't think you have to be in the same thread to draw on another
window, just send it messages (and a lot of APIs send messages
implicitly of course, but still, this is usually documented).

So, I don't know about Java. Certainly the Delphi VCL, MFC, probably the
ATL, and probably Qt as well all suffer from this issue. It's just a
part of programming on Windows the toolkits assume you know about. 

The fix is normally to run an event loop in any thread you create a
window in, which typically isn't too hard. The Win32 API requires you to
do this in certain circumstances anyway, certainly when using parts of
DCOM and I think maybe the DDE APIs as well....

thanks -mike

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]