
visage - issue #8
onthread, offthread -- syntax keyword for worker tasks that is an expression type
Possible enhancement:
def button = Button { action: function(evt):void { offthread { def r = doSomethingLong(); onthread { textField.value = r; } } }
Although 2.0 is supposed to have better support for multithreading, I'd guess there will still be an event thread even if there isn't a single drawing thread any more. So, syntax support for worker tasks may still be handy?
Using a syntax keyword (with an expression return type) could also allow things like:
def button = Button [ action: bind onthread if model.myTest then functionA else functionB }
Ensuring that the switch of the event listener happens on the event thread.
If we wanted to be tricky we could generalise it so that "onthread" puts it back on the thread from which "offthread" was called (ie, not just a specific keyword for the event thread).
Comment #1
Posted on Oct 4, 2010 by Happy Rhino(Sorry this came through as a "defect" -- I must have missed the option in Google Code to set it to enhancement)
Comment #2
Posted on Oct 4, 2010 by Grumpy MonkeyI set it as an enhancement.
I have a feeling that the 2.0 multithreading support is going to be largely based around the SwingWorker model. Furthermore it will likely rely on the existing Java multithreading features. I think that the first thing that we should do is try to surface some of the java multithreading features (at least the synchronized feature) so that you can write thread safe code in javafx. I will log an additional enhancement for that.
Comment #3
Posted on Mar 8, 2011 by Grumpy PandaWith JavaFX 2.0 multi-threading support is a must. I cannot reveal what the details are on multi-threading in JavaFX 2.0.
The only thing I can say is that Visage will need it in order to fully develop a JavaFX application. Otherwise any parts requiring multi-threading (certain JavaFX APIs require this including an essential one which is unavoidable) will have to be done in Java, or any other JVM language with built in multi-threading functionality.
Time will tell how long Visage users will be able to tolerate this. For any substantial GUI application (of a reasonable size) having the functionality available is a must. With JavaFX 2.0 being in constant flux there may be a possibility that some GUI APIs require multi-threading. If that is the case then multi-threading support is going to become just as essential as Generics support.
Considering the very high priority for Visage to support JavaFX application development, and that most developers are planning to create JavaFX applications with Visage I have changed priority from Medium to High.
Comment #4
Posted on Mar 9, 2011 by Grumpy PandaAfter having a discussion with Chris Oliver I found out that implementing multi-threading in Visage is trivial. Only the compiler runtime needs to be adjusted. No changes are needed for the compiler itself.
Status: New
Labels:
Type-Enhancement
Priority-High