1
0
mirror of https://github.com/golang/go synced 2024-11-05 17:46:16 -07:00

runtime: clarify comment for m->locked

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11671043
This commit is contained in:
Dmitriy Vyukov 2013-07-22 16:37:31 +04:00
parent 5d14b89933
commit 27134567fa

View File

@ -359,9 +359,13 @@ struct P
byte pad[64]; byte pad[64];
}; };
// The m->locked word holds a single bit saying whether // The m->locked word holds two pieces of state counting active calls to LockOSThread/lockOSThread.
// external calls to LockOSThread are in effect, and then a counter // The low bit (LockExternal) is a boolean reporting whether any LockOSThread call is active.
// of the internal nesting depth of lockOSThread / unlockOSThread. // External locks are not recursive; a second lock is silently ignored.
// The upper bits of m->lockedcount record the nesting depth of calls to lockOSThread
// (counting up by LockInternal), popped by unlockOSThread (counting down by LockInternal).
// Internal locks can be recursive. For instance, a lock for cgo can occur while the main
// goroutine is holding the lock during the initialization phase.
enum enum
{ {
LockExternal = 1, LockExternal = 1,