Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] SWT Main Thread calling into a COM MTA

Perhaps the question regarding the native thread being created by CreateWindow() is based on experience with AWT/Swing instead of SWT. From what I can deduce, in AWT/Swing the message processing loop and thread are hidden from AWT/Swing apps and is created implicitly on-demand when and if the thread of main() indirectly creates a native window. This explains, at least partially, why AWT/Swing apps that create windows do not terminate when main() returns whereas non-GUI non-thread-creating apps terminate when main() returns. On the other hand, SWT apps, which are like apps for Windows and certain other OSes, have an explicit message loop that runs on the primary thread inside main(). SWT apps are bounded by the execution of main() whereas AWT/Swing apps are not.
 
This may also explain the question about PostThreadMessage(). If no window is ever created but another thread is created, PostThreadMessage() can be used to post messages from one non-GUI thread to another non-GUI thread. Or, it can be used to post messages from a GUI thread to a non-GUI thread. From PostThreadMessage() docs: "The hwnd member of the returned MSG structure is NULL. Messages sent by PostThreadMessage are not associated with a window."
 
Of course, if any of this is inaccurate or not what was intended by the original question, please correct.
 
----- Original Message -----
Sent: Wednesday, August 12, 2009 10:00 AM
Subject: Re: [platform-swt-dev] SWT Main Thread calling into a COM MTA


I am not sure I understand your question. CreateWindow() does not created a thread.

The SWT UI thread is the main thread for java (where the apps main() method is called). It is created by the JVM. I believe COM is initialized in the SWT UI thread by calling OleInitialize() which makes its apartment STA.

Silenio



"J.T. -" <gisfromscratch@xxxxxxx>
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx

08/11/2009 06:16 PM

Please respond to
"Eclipse Platform SWT component developers list."        <platform-swt-dev@xxxxxxxxxxx>

To
<platform-swt-dev@xxxxxxxxxxx>
cc
Subject
[platform-swt-dev] SWT Main Thread calling into a COM MTA





Hi,

We have some heavy problems (deadlocks, crashes) developing on Windows XP using Eclipse RCP calling from the SWT UI Main Thread into a COM MTA. When we are calling from a none UI thread or the AWT Event Dispatch thread these problems doesn't occur.

How is this thread created natively?
Indirectly by calling CreateWindow(Ex) or just a CreateThread handle which gets messages by calling PostThreadMessage of the Win32 API?


Thanks in advance.


-> Für Fotos hier abdrücken _______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

Back to the top