* 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
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
// NOTE: The returned pointer may keep the whole map live, so don't
// hold onto it for very long.
func mapaccess1(t *maptype, h *hmap, key unsafe.Pointer) unsafe.Pointer {
+ // Check preemption, since unlike gc we don't check on every call.
+ if getg().preempt {
+ checkPreempt()
+ }
+
if raceenabled && h != nil {
callerpc := getcallerpc()
pc := funcPC(mapaccess1)
}
func mapaccess2(t *maptype, h *hmap, key unsafe.Pointer) (unsafe.Pointer, bool) {
+ // Check preemption, since unlike gc we don't check on every call.
+ if getg().preempt {
+ checkPreempt()
+ }
+
if raceenabled && h != nil {
callerpc := getcallerpc()
pc := funcPC(mapaccess2)
// returns both key and value. Used by map iterator
func mapaccessK(t *maptype, h *hmap, key unsafe.Pointer) (unsafe.Pointer, unsafe.Pointer) {
+ // Check preemption, since unlike gc we don't check on every call.
+ if getg().preempt {
+ checkPreempt()
+ }
+
if h == nil || h.count == 0 {
return nil, nil
}
// Like mapaccess, but allocates a slot for the key if it is not present in the map.
func mapassign(t *maptype, h *hmap, key unsafe.Pointer) unsafe.Pointer {
+ // Check preemption, since unlike gc we don't check on every call.
+ if getg().preempt {
+ checkPreempt()
+ }
+
if h == nil {
panic(plainError("assignment to entry in nil map"))
}
}
func mapiternext(it *hiter) {
+ // Check preemption, since unlike gc we don't check on every call.
+ if getg().preempt {
+ checkPreempt()
+ }
+
h := it.h
if raceenabled {
callerpc := getcallerpc()
// setting a global variable and figuring out a way to efficiently
// check that global variable.
//
- // For now we check gp.preempt in schedule and mallocgc,
- // which is at least better than doing nothing at all.
+ // For now we check gp.preempt in schedule, mallocgc, selectgo,
+ // and a few other places, which is at least better than doing
+ // nothing at all.
return true
}