Infinite loop hanging app when working with threads
Posted by Alberto Martins on Jun 27, 2016; 7:19pm
URL: https://forum.jogamp.org/Infinite-loop-hanging-app-when-working-with-threads-tp4036849.html
I am facing a issue using Newts GLWindow painting to FBO.
To help validate the issue I made a simple application to reproduce the problem:
public static GLWindow window;
public static Animator animator;
public static void main( String[] args )
{
// ExecutorService pool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
// pool.execute(new WorkerThread());
GLProfile glp = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glp);
caps.setBackgroundOpaque(false);
caps.setOnscreen(false);
window = GLWindow.create(caps);
animator = new Animator(window);
//Size is purposely big to make exception be thrown
window.setSize(40000, 40000);
window.setVisible(true);
System.out.println("TEST2");
}
If I execute this simple code in the main Thread, the exception is thrown as expected.
However, if I run the same code inside a thread (uncomment the first two lines of the main, creating a WorkerThread class with the same code), the application enters an infinite loop in the jogamp.newt.DefaultEDTUtil class, precisely in the line 347 of the run() method.
Is this a bug in the API implementation, or is there a way to force this thread to exit?
Regards,
Alberto Martins