Commit Graph

5 Commits

Author SHA1 Message Date
Sérgio Faria
794e24e879 The current EventThread doesn't need to be volatile
Citing the JLS (Java 7) §17.4.5:
> A call to start() on a thread happens-before any actions in
> the started thread.

Other threads calling isCurrent(), can see stale values of the static
variable, as it doesn't affect the result.

Nulling the thread variable, cannot be reordered with the new Thread because
a synchronized(EventThread.class) precedes the first task submission on a new
Executor, causing a happens-before relationship that ensures the null is
already visible to the thread on netTick (that will create the EventThread).
2014-08-28 21:42:10 +01:00
Naoyuki Kanezawa
21fb11f0c2 synchronize access to the ExecutorService 2014-08-17 01:42:52 +09:00
Naoyuki Kanezawa
bf3bc57244 add try-finally 2014-08-16 23:44:37 +09:00
Naoyuki Kanezawa
f3057dd5d3 fix #4 gracefully shutdown all ExecutorServices 2014-08-16 20:04:20 +09:00
Naoyuki Kanezawa
808ad8c4f1 move EventThread 2014-03-25 23:33:58 +09:00