// **NOTE** should only be called while the lock write mutex is acquired
503387
func (t *Transport) getOrCreatePeer(pid peer.Identifier) *tchannelPeer {
	addr := pid.Identifier()
	if p, ok := t.peers[addr]; ok {
		return p
	}

	p := newPeer(addr, t)
	t.peers[addr] = p
	// Start a peer connection loop
	t.connectorsGroup.Add(1)
	go p.MaintainConn()

	return p
}
503042
func WritePin(pin Pin, state State) {
	p := uint8(pin)

	// Set register, 7 / 8 depending on bank
	// Clear register, 10 / 11 depending on bank
	setReg := p/32 + 7
	clearReg := p/32 + 10

	memlock.Lock()

	if state == Low {
		gpioMem[clearReg] = 1 << (p & 31)
	} else {
		gpioMem[setReg] = 1 << (p & 31)
	}
	memlock.Unlock() // not deferring saves ~600ns
}
612756
func (rw LeveledRWMutex) AssertRLocked(lockState *LockState) {
	et := lockState.getExclusionType(rw.level)
	if et != readExclusion {
		panic(unexpectedExclusionTypeError{
			levelToString:         lockState.levelToString,
			level:                 rw.level,
			expectedExclusionType: readExclusion,
			exclusionType:         et,
		})
	}
}
1201378
func (ca *CertificateAuthorityImpl) noteSignError(err error) {
	if err != nil {
		if _, ok := err.(*pkcs11.Error); ok {
			ca.stats.Inc(metricHSMError, 1)
		} else if cfErr, ok := err.(*cferr.Error); ok {
			ca.stats.Inc(fmt.Sprintf("%s.%d", metricSigningError, cfErr.ErrorCode), 1)
		}
	}
	return
}
175274
func (f Filter) NotEndsWith(val interface{}) Filter {
	f.Op = "!$="
	f.Val = val
	return f
}
939568
func (it *NoteIterator) Next() (noteId, annotatedId *Oid, err error) {
	noteId, annotatedId = new(Oid), new(Oid)

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_note_next(noteId.toC(), annotatedId.toC(), it.ptr)
	runtime.KeepAlive(noteId)
	runtime.KeepAlive(annotatedId)
	runtime.KeepAlive(it)
	if ret < 0 {
		err = MakeGitError(ret)
	}
	return
}
817628
func (i *i) NotEqual(a, b interface{}) {
	if areEqual(a, b) {
		i.Logf("%v == %v", a, b)
	}
}
734627
func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
	if h, ok := t.(tHelper); ok {
		h.Helper()
	}
	if assert.NotEmpty(t, object, msgAndArgs...) {
		return
	}
	t.FailNow()
}
1310594
func (r Network_ContentDelivery_Account) UpdateNote(note *string) (resp bool, err error) {
	params := []interface{}{
		note,
	}
	err = r.Session.DoRequest("SoftLayer_Network_ContentDelivery_Account", "updateNote", params, &r.Options, &resp)
	return
}
1326141
func (r User_Customer_External_Binding_Phone) UpdateNote(text *string) (resp bool, err error) {
	params := []interface{}{
		text,
	}
	err = r.Session.DoRequest("SoftLayer_User_Customer_External_Binding_Phone", "updateNote", params, &r.Options, &resp)
	return
}
1174755
func (t *Thread) WriteMemory(addr uintptr, data []byte) (int, error) {
	panic(ErrNativeBackendDisabled)
}
730113
func (m *MutexKV) Lock(key string) {
	log.Printf("[DEBUG] Locking %q", key)
	m.get(key).Lock()
	log.Printf("[DEBUG] Locked %q", key)
}
738780
func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
	if h, ok := t.(tHelper); ok {
		h.Helper()
	}
	return NotEmpty(t, object, append([]interface{}{msg}, args...)...)
}
149827
func (s *InviteAccountToOrganizationInput) SetNotes(v string) *InviteAccountToOrganizationInput {
	s.Notes = &v
	return s
}
943571
func (a *AuthorizationRequest) GetNote() string {
	if a == nil || a.Note == nil {
		return ""
	}
	return *a.Note
}
814374
func (m *multiWriter) Write(p []byte) (n int, err error) {
	// lock and make a local copy of available writers:
	getWriters := func() (writers []writerWrapper) {
		m.RLock()
		defer m.RUnlock()
		writers = make([]writerWrapper, 0, len(m.writers))
		for _, w := range m.writers {
			writers = append(writers, w)
		}

		// add the recent write chunk to the "instant replay" buffer
		// of the session, to be replayed to newly joining parties:
		m.lockedAddRecentWrite(p)
		return writers
	}

	// unlock and multiplex the write to all writers:
	for _, w := range getWriters() {
		n, err = w.Write(p)
		if err != nil {
			if w.closeOnError {
				return
			}
			continue
		}
		if n != len(p) {
			err = io.ErrShortWrite
			return
		}
	}
	return len(p), nil
}
341877
func (fbo *folderBlockOps) notifyErrListenersLocked(
	lState *kbfssync.LockState, ptr data.BlockPointer, err error) {
	fbo.blockLock.AssertLocked(lState)
	if isRecoverableBlockError(err) {
		// Don't bother any listeners with this error, since the sync
		// will be retried.  Unless the sync has reached its retry
		// limit, but in that case the listeners will just proceed as
		// normal once the dirty block cache bytes are freed, and
		// that's ok since this error isn't fatal.
		return
	}
	df := fbo.dirtyFiles[ptr]
	if df != nil {
		df.NotifyErrListeners(err)
	}
}