awvalenti / bauhinia

Cross-platform Wii Remote Java library and remote controller application
GNU General Public License v3.0
6 stars 0 forks source link

Postpone firing some events to the end of current thread execution #50

Open awvalenti opened 7 years ago

awvalenti commented 7 years ago

To be the equivalent of JavaScript's setTimeout(function() {...}, 0).

This applies especially the connected event.

Something like SwingUtilities.invokeLater may do the job, but we should not depend on Swing being available.

awvalenti commented 7 years ago

To better understand this issue, check the ConsoleLeds demo: it does stuff on connected method, including Thread.sleep. But connected is called when Wii Remote is connected, and there's a big call stack happening there.