diff options
| author | Pietro Gagliardi <[email protected]> | 2014-02-18 09:57:19 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-02-18 09:57:19 -0500 |
| commit | 1f08c874e0c9df9019e994098e1d006a7011e533 (patch) | |
| tree | 7d19b3d64b35e4746d1816b81d0f05e1aadf0f34 /sysdata.go | |
| parent | 16ab1763ba7468314972b962440ff80dad2997f5 (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.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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 |
