[2.0 RC3] PBuffer uses awtlock during display
Posted by Tovi on Sep 21, 2011; 2:30pm
URL: https://forum.jogamp.org/2-0-RC3-PBuffer-uses-awtlock-during-display-tp3355580.html
Hey,
Just a quick question, cause I'm kindof stuck with this.
I'm trying to do some onscreen rendering while at the same time also do some offscreen rendering in a separate thread (using GLPBuffer). The problem I noticed is that the GLPBuffer seems to call Suntoolkit.awtlock(). This has the potential for deadlocks, as the onscreen view features some Swing components that also lock awt.
Is there a way to disable the locking of AWT for PBuffers? I noticed there is an exception for headless mode, but this is not an option for me.
I also found some documentation that said that "-Dnativewindow.nolocking=true" would force the toolkit lock to be disabled, but I didn't find any reference to this in the code, so I'm guessing this is no longer valid?
As a quick test I tried uncommenting the part where the lock is taken (JAWTUtil.awtLock() and JAWTUtil.awtUnlock()), and everything seemed to work just fine.
So my questions are:
- Why enforce an awtlock on PBuffers?
- Wouldn't it be better to have a separate static lock for nativewindow so as to prevent deadlocks in multithreading environments?
- Is there any way currently to disable awt locking without modifying the source code? (I'm trying to work with binaries as much as possible, since managing sources can be tedious over time)
If needed, I would be up for adapting the code to suit my needs, and let you determine whether you want to insert it to your code ;)
Please also let me know if I'm missing something, or doing something wrong.
Thx in advance,
Tovi