Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Lock ¶
func Lock(s string)
Lock locks a mutex in the mutexMap. If the mutex is already in the map, it locks the current call. After it another call unlocks the mutex (and deletes it from the mutexMap) the mutex written again into the mutexMap. If the mutex was not in the mutexMap before, a new mutext is created and locked and written into the mutexMap.
func LockWithContext ¶
LockWithContext locks a mutex only if it hasn't been locked before in a context. LockWithContext should be used to lock objects like faucets etc. The context carries a uid that is unique the each request (message, button press, etc.). If the uid has a lock already *for a certain object*, it increments the nLocks in the mutexMap. If not, it locks the object. This is supposed to lock only if nLock == 0.
func UnlockHTTP ¶
func UnlockHTTP(w http.ResponseWriter, r *http.Request)
func UnlockWithContext ¶
UnlockWithContext unlock a mutex only if it has been locked once within a context. If it has been locked more than once it only decrements nLocks and skips the unlock of the mutex. This is supposed to unlock only for nLocks == 1
Types ¶
This section is empty.