summaryrefslogtreecommitdiff
path: root/sysdata.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-18 09:57:19 -0500
committerPietro Gagliardi <[email protected]>2014-02-18 09:57:19 -0500
commit1f08c874e0c9df9019e994098e1d006a7011e533 (patch)
tree7d19b3d64b35e4746d1816b81d0f05e1aadf0f34 /sysdata.go
parent16ab1763ba7468314972b962440ff80dad2997f5 (diff)
Made event dispatch asynchronous to avoid deadlocks; right now events that cannot be dispatched get dropped.
Diffstat (limited to 'sysdata.go')
-rw-r--r--sysdata.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/sysdata.go b/sysdata.go
index e4885ac..da94766 100644
--- a/sysdata.go
+++ b/sysdata.go
@@ -55,6 +55,19 @@ func (c *cSysData) delete(int) error {
panic(runtime.GOOS + " sysData does not define delete()")
}
+// signal sends the event signal. This raise is done asynchronously to avoid deadlocking the UI task.
+// Thanks skelterjohn for this techinque: if we can't queue any more events, drop them; TODO this would be best if the channel is buffered
+func (s *cSysData) signal() {
+ if s.event != nil {
+ go func() {
+ select {
+ case s.event <- struct{}{}:
+ default:
+ }
+ }()
+ }
+}
+
const (
c_window = iota
c_button