|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jogamp.newt.util.MainThread
public class MainThread
NEWT Utility class MainThread
This class provides a startup singleton main thread,
from which a new thread with the users main class is launched.
Such behavior is necessary for native windowing toolkits,
where the windowing management must happen on the so called
main thread e.g. for Mac OS X !
Utilizing this class as a launchpad, now you are able to
use a NEWT multithreaded application with window handling within the different threads,
even on these restricted platforms.
To support your NEWT Window platform,
you have to pass your main thread actions to invoke(..)
,
have a look at the MacWindow
implementation.
TODO: Some hardcoded dependencies exist in this implementation,
where you have to patch this code or factor it out.
If your platform is not Mac OS X, but you want to test your code without modifying
this class, you have to set the system property newt.MainThread.force
to true
.
The code is compatible with all other platform, which support multithreaded windowing handling.
Since those platforms won't trigger the main thread serialization, the main method
will be simply executed, in case you haven't set newt.MainThread.force
to true
.
Test case on Mac OS X (or any other platform):
java -XstartOnFirstThread com.jogamp.newt.util.MainThread demos.es1.RedSquare -GL2 -GL2 -GL2 -GL2Which starts 4 threads, each with a window and OpenGL rendering.
Field Summary | |
---|---|
protected static boolean |
DEBUG
|
static boolean |
USE_MAIN_THREAD
|
Constructor Summary | |
---|---|
MainThread()
|
Method Summary | |
---|---|
static void |
exit()
|
static void |
invoke(boolean wait,
Runnable r)
invokes the given Runnable |
static boolean |
isRunning()
|
static void |
main(String[] args)
Your new java application main entry, which pipelines your application |
static void |
run()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final boolean USE_MAIN_THREAD
protected static final boolean DEBUG
Constructor Detail |
---|
public MainThread()
Method Detail |
---|
public static void main(String[] args)
public static void invoke(boolean wait, Runnable r)
public static void exit()
public static boolean isRunning()
public static void run()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |