While browsing the code for GLContext i found difficult to understand this code at the beginning of setRenderingThread:
Thread currentThread = Thread.currentThread();
if (currentThreadOrNull != null && currentThreadOrNull != currentThread) {
throw new GLException("Argument must be either the current thread or null");
}
Why having to pass the currentThreadOrNull argument if it cannot be null or different from Thread.currentThread()?
Having the method written as:
public synchronized void setRenderingThread(Runnable initAction) {
Thread currentThread = Thread.currentThread();
...
[s] if (currentThreadOrNull != null && currentThreadOrNull != currentThread) {
throw new GLException("Argument must be either the current thread or null");
}
[/s]
...
shall avoid the many unexpected exceptions and related questions?
Or i missed something obvious ???