Bugzilla – Attachment 276 Details for
Bug 519
GLPBuffer takes awtlock during painting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
Test that demonstrates deadlock.
TestPBufferDeadlock.java (text/x-java), 2.11 KB, created by
Daniel Balog
on 2011-10-03 13:30:43 CEST
(
hide
)
Description:
Test that demonstrates deadlock.
Filename:
MIME Type:
Creator:
Daniel Balog
Created:
2011-10-03 13:30:43 CEST
Size:
2.11 KB
patch
obsolete
> >import com.jogamp.opengl.test.junit.util.UITestCase; >import org.junit.*; >import sun.awt.SunToolkit; > >import javax.media.opengl.*; >import java.util.concurrent.ExecutorService; >import java.util.concurrent.Executors; > >public class TestPBufferDeadLock extends UITestCase { > static GLProfile glp; > static int width, height; > private ExecutorService fSingleThreadExecutorService; > > @BeforeClass > public static void initClass() { > glp = GLProfile.getDefault(); > Assert.assertNotNull( glp ); > width = 512; > height = 512; > } > > @AfterClass > public static void releaseClass() { > } > > @Override @Before > public void setUp() { > super.setUp(); > fSingleThreadExecutorService = Executors.newFixedThreadPool( 1 ); > } > > protected void runTestGL( GLCapabilities caps ) throws InterruptedException { > final GLPbuffer pbuffer = GLDrawableFactory.getFactory( GLProfile.get( "GL2" ) ).createGLPbuffer( > null, > caps, > new DefaultGLCapabilitiesChooser(), > 512, > 512, > null > ); > > final boolean[] done = {false}; > Runnable runnable = new Runnable() { > public void run() { > pbuffer.display(); > done[ 0 ] = true; > } > }; > try { > SunToolkit.awtLock(); > fSingleThreadExecutorService.execute( runnable ); > while ( !done[ 0 ] ) { > try { > Thread.sleep( 100 ); > } > catch ( InterruptedException e ) { > Assert.fail( "Failed to sleep" ); > } > } > > } > finally { > SunToolkit.awtUnlock(); > } > } > > @Test(timeout = 10000) //10 second timeout > public void testDeadlock() throws InterruptedException { > GLCapabilities caps = new GLCapabilities( glp ); > runTestGL( caps ); > } > > static long duration = 500; // ms > > public static void main( String args[] ) { > for ( int i = 0; i < args.length; i++ ) { > if ( args[ i ].equals( "-time" ) ) { > i++; > try { > duration = Integer.parseInt( args[ i ] ); > } > catch ( Exception ex ) { > ex.printStackTrace(); > } > } > } > org.junit.runner.JUnitCore.main( TestPBufferDeadLock.class.getName() ); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 519
: 276 |
283