Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting thread info from sub-threads.



I think not...but I could be wrong....maybe it's a matter of terminology.

The main thread, at least to me, would be the thread that contains the the main() method....in other words, the thread that parents all other threads in the program. This couldn't be the EDT to the best of my knowledge. The EDT handles all events, which typically means GUI related events, but I don't think it's neccesarilly limited to just those GUI events. From my original e-mail, here's the list of threads:

Name: Reference Handler, Thread Group: system, Priority: 10, Daemon: true
Name: Finalizer, Thread Group: system, Priority: 8, Daemon: true
Name: Signal Dispatcher, Thread Group: system, Priority: 9, Daemon: true
Name: Java2D Disposer, Thread Group: system, Priority: 10, Daemon: true
Name: AWT-AppKit, Thread Group: main, Priority: 5, Daemon: true
Name: AWT-Shutdown, Thread Group: main, Priority: 5, Daemon: false
Name: AWT-EventQueue-0, Thread Group: main, Priority: 6, Daemon: false
Name: Thread-1, Thread Group: main, Priority: 5, Daemon: false
Name: Thread-0, Thread Group: main, Priority: 5, Daemon: false
Name: DestroyJavaVM, Thread Group: main, Priority: 5, Daemon: false
Name: TimerQueue, Thread Group: main, Priority: 5, Daemon: true


In the list above, Thread-0 and Thread-1 are both two threads that main() launched...they are in effect the running remnants of main(). The EDT I BELIEVE (but I'm not certain) is the AWTEventQueue. When a program uses an "invokeLater()" I believe what it's doing is handing the workload of updating graphics etc, to the EDT and telling the EDT to do it when it has a chance.

I took the invokeLater() out of the code and it STILL isn't showing up in the list of threads. I also tried it on Linux and had the same results, so I must assume it's something I'm doing.

One guy told me that there's no guarantee that all threads in a particular group may be reported. Is there truth to that???

Thanks













Michael Hall wrote:


On Aug 21, 2006, at 2:27 PM, bsd5tu1 wrote:

invokeAndWait()


Someone can correct me if wrong here. Not a Swing guru.
But if you are talking about SwingUtilities I believe this means the code will run on the dreaded EDT - event dispatcher thread, AKA the main thread. So this means the code will be scheduled to run on the EDT thread, in the meantime the current thread will stop and wait until the invoke completes. Possibly dangerous if you are on another event related (current) thread, you might slow down or lock up the GUI/application, the invokeLater method - running asynchronously, is more usual I think.



Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative





_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Getting thread info from sub-threads. (From: bsd5tu1 <email@hidden>)
 >Re: Getting thread info from sub-threads. (From: Michael Hall <email@hidden>)
 >Re: Getting thread info from sub-threads. (From: bsd5tu1 <email@hidden>)
 >Re: Getting thread info from sub-threads. (From: Michael Hall <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.