A read-write thread lock.
Permits multiple readers to hold the while, while only allowing at most one writer to hold the lock.
For a writer to acquire the lock all readers must have unlocked.
For a reader to acquire the lock no writers must hold the lock.
func tryReadLock() -> Bool
Attempts to acquire the lock for reading.
Returns false if the lock is held by a writer or an error occurs.
func tryWriteLock() -> Bool
Attempt to acquire the lock for writing.
Returns false if the lock is held by readers or a writer or an error occurs.
func unlock() -> Bool
Unlock a lock which is held for either reading or writing.
Returns false if an error occurs.