It occured to me the other day that it's dead easy to write a safe
"sync-exec" clojure version of SWT's Display/syncExec method.
The idea is to really execute a Display/asyncExec call, but make the calling
thread wait for the asyncExec return value via clojure dataflow feature, aka
promise/deliver/deref :
(defn async-exec [display f] (.asyncExec display (f)))
(defn sync-exec
"Safe version of sync-exec, using async-exec under the hood,
and a promise to wait for async-exec return value"
[display f]
(let [r (promise)]
(async-exec display #(deliver r (f)))
@r))
By the way, are there any open source Clojure/SWT I should be aware of, or
not yet ?
Cheers,
--
Laurent
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en