jogamp.common.util.locks.RecursiveLockImpl01Unfairish.lock timeout exception
Posted by Vaxquis on May 17, 2012; 10:53pm
URL: https://forum.jogamp.org/jogamp-common-util-locks-RecursiveLockImpl01Unfairish-lock-timeout-exception-tp3999944.html
I've a question/request for a feature concerning this class/method. Since timeouts (especially with default t=5000ms) are commonly generated, e.g. when starting OpenGL rendering ASAP after starting the app (or when resizing a Swing window, due to the sheer amount of redraws needed and when there's no setSize event filtering implemented), could you possibly do one or couple of the following:
a) change the type of exception cast on timeout from RuntimeException to something more unique and explicit, allowing catching this single exception and handling it in a proper way,
b) reduce the amount of exceptions cast - currently there are 2 exceptions on every timeout, one from jogamp.newt.DefaultEDTUtil$EventDispatchThread.run (uncatchable, since it happens in a NEWT EDT thread) and the other one in client code - frankly I think that one exception is enough, see below -
c) provide me with some clues for logical way of handling your RuntimeException-s - for me, there should be an option for quiet timeouts, resulting in a frameskip in laggy conditions (code below shows the general idea behind it),
d) give me some insight what was your intention when it came to desiging this general timeout concept.
proof of concept code:
SC3D_animator.add( new SC_Timer.descriptor() {
@Override
public boolean timer_event() {
if ( my_GLEL.is_disposed() ) {
SC3D_animator.stop(); // schedule timer stop
return false;
}
try {
f_newt.display();
} catch (Exception ex) {
if ( ex.getStackTrace()[0].getClassName().equals( "jogamp.common.util.locks.RecursiveLockImpl01Unfairish" ) )
global.debug_info( "frame timeout in drawing code" );
else
global.report_exception( ex );
}
if ( display_FPS )
f_cp.setTitle( base_title + " - FPS: " + (float) ( (int) ( f_newt.getLastFPS() * 100 ) ) / 100 );
return true;
}
works as intended (frameskip on lag), but still floods the stderr with exception reports from EDT.
regards, Vax.