diff options
Diffstat (limited to 'libgo/go/runtime/chan.go')
-rw-r--r-- | libgo/go/runtime/chan.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libgo/go/runtime/chan.go b/libgo/go/runtime/chan.go index bf708aec5c4..87f7879e6f5 100644 --- a/libgo/go/runtime/chan.go +++ b/libgo/go/runtime/chan.go @@ -148,6 +148,11 @@ func chansend1(c *hchan, elem unsafe.Pointer) { * the operation; we'll see that it's now closed. */ func chansend(c *hchan, ep unsafe.Pointer, block bool, callerpc uintptr) bool { + // Check preemption, since unlike gc we don't check on every call. + if getg().preempt { + checkPreempt() + } + if c == nil { if !block { return false @@ -430,6 +435,11 @@ func chanrecv(c *hchan, ep unsafe.Pointer, block bool) (selected, received bool) print("chanrecv: chan=", c, "\n") } + // Check preemption, since unlike gc we don't check on every call. + if getg().preempt { + checkPreempt() + } + if c == nil { if !block { return |