Purpose of Thread.sleep(1000) in startup?

I’m seeing a Thread.sleep(1000) in LwjglCanvas.createContext(AppSettings), between keyboard and vsync configuration.

What’s the purpose of the wait?

If it’s not needed anymore, it would be nice to shave that second off the start-up time.

If it’s necessary, it would be nice to have a comment that explained it.

(Seen on current HEAD = rev 9890.)

1 Like

It happened on r8210: https://code.google.com/p/jmonkeyengine/source/diff?spec=svn8210&r=8210&format=side&path=/trunk/engine/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglCanvas.java

No explanation or comment for the wait, probably should have written something but its too late now…

The canvas is already a big hack and people are still having issues with it on all 3 platforms. I think at this point we can only hope for JOGL to have a working canvas as I don’t see any way of having the current one work.

Heheh… in this case, Thread.sleep(1000) = “breaks randomly less often”. :slight_smile:

If it’s resizing issues: I’m currently having one of these myself, but I’m still in the process of determining where the problem lies. The usual trouble with layout management in Swing - if you have a small bug in that area, Swing will mostly work and sometimes misbehave in hard-to-diagnose ways.

Could actually be Canvas or my code, I don’t know yet. If it’s something in Canvas, I’ll let you guys know.

Are there other issues? I want to do something windowed, but if it can’t be made to work reliably, then that’s that and I’ll stick with fullscreen anyway.

Okay, the resizing issues had nothing to do with Canvas, and all with not passing on changes appropriately.

I’ll start a separate thread for that.