Documentation
¶
Index ¶
Constants ¶
const UIDPrefix = "#UID-"
UIDPrefix is the prefix to use for unique identifiers.
Variables ¶
Marshalers is a map of registered .wrj marshalers keyed by uppercased field names.
var NextUID <-chan string
NextUID returns a unique identifier. To keep the identifier compact it is a uint that is encoded in base 36 using the digits 0-9 and letters A-Z. This will result in an identifier in the range 0 to 3W5E11264SG0G prefixed with UIDPrefix. Examples for a unique identifier are #UID-0 & #UID-3W5E11264SG0G.
Functions ¶
Types ¶
type BRL ¶
type BRL struct {
// contains filtered or unexported fields
}
BRL or 'Big Room Lock' is responsible for all of the 'in game' locking. Named in tribute to the Linux kernel 'big kernel lock' that is no more. In Linux the BKL stopped concurrency in kernel space. In WolfMUD the BRL stops concurrency within a 'location'. Unlike the BKL the BRL is not a recursive lock. If you need to change what you are locking, release all the locks held and reacquire them. Otherwise subtle and not so subtle BadThings™ are bound to happen.
Each BRL has a unique lock ID associated with it so that locks can be obtained and released in a consistent order. This is the classic resource hierarchy solution proposed by Dijkstra to the dining philosophers problem to avoid deadlocks and livelocks:
https://en.wikipedia.org/wiki/Dining_philosophers_problem
A BRL also fulfils the sync.Locker interface.
TODO: Add more details on the BRL, lockID and implications of room level locking.
func (BRL) Lock ¶
func (brl BRL) Lock()
Lock locks the specified BRL and implements Lock for a sync.Locker
func (BRL) LockID ¶
LockID returns the unique lock ID associated with a specific BRL.