summaryrefslogtreecommitdiff
path: root/uitask.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-03 11:04:07 -0400
committerPietro Gagliardi <[email protected]>2014-07-03 11:04:07 -0400
commit1238936a16170757104879d9593ba9440c70e8cd (patch)
treeeade2af3e7602a986dd7144032c72a18f59c9825 /uitask.go
parentf7dedc8cb05960134234f242042a4f00d88aaf9e (diff)
Added Post() and implemented it on Windows.
Diffstat (limited to 'uitask.go')
-rw-r--r--uitask.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/uitask.go b/uitask.go
index fceab1b..40fe003 100644
--- a/uitask.go
+++ b/uitask.go
@@ -26,6 +26,14 @@ func Go(start func()) error {
return nil
}
+// Post issues a request to the given Window to do something on the main thread.
+// Note the name of the function: there is no guarantee that the request will be handled immediately.
+// Because this can be safely called from any goroutine, it is a package-level function, and not a method on Window.
+// TODO garbage collection
+func Post(w *Window, data interface{}) {
+ uipost(w, data)
+}
+
// TODO this needs to be replaced with a function
// Stop should be pulsed when you are ready for Go() to return.
// Pulsing Stop will cause Go() to return immediately; the programmer is responsible for cleaning up (for instance, hiding open Windows) beforehand.