Go to the source code of this file.
◆ EXCL_LOCKS
◆ Lock
◆ lock_how
Locking type
Enumerator |
---|
READ_LOCK | lock for reading
|
WRITE_LOCK | lock for writing
|
SHARED_LOCK | as a shared lock
|
◆ CheckLock()
int CheckLock |
( |
struct Lock * |
lock | ) |
|
Check the status of the lock
- Parameters
-
- Returns
- 0 ff the lock is not acquired. If the lock is currently acquired for reading returns the amount of readers. And -1 if the lock is acquired obtained for writing or as a shared lock.
◆ Lock_Init()
void Lock_Init |
( |
struct Lock * |
lock | ) |
|
Initialize the Lock structure
- Parameters
-
◆ Lock_Obtain()
void Lock_Obtain |
( |
struct Lock * |
lock, |
|
|
int |
how |
|
) |
| |
Obtain the lock
- Parameters
-
lock | pointer to the lock |
how | locking type |
◆ Lock_ReleaseR()
void Lock_ReleaseR |
( |
struct Lock * |
lock | ) |
|
Release lock obtained for reading
- Parameters
-
◆ Lock_ReleaseW()
void Lock_ReleaseW |
( |
struct Lock * |
lock | ) |
|
Release lock obtained for writing
- Parameters
-
◆ ObtainDualLock()
Safely obtain two simultaneous locks
- Parameters
-
lock_1 | pointer to the first lock |
how_1 | first lock's type |
lock_2 | pointer to the second lock |
how_2 | second lock's type |
◆ ObtainReadLock()
void ObtainReadLock |
( |
struct Lock * |
lock | ) |
|
Obtain the lock for reading
- Parameters
-
◆ ObtainSharedLock()
void ObtainSharedLock |
( |
struct Lock * |
lock | ) |
|
Obtain the lock as shared lock
- Parameters
-
◆ ObtainWriteLock()
void ObtainWriteLock |
( |
struct Lock * |
lock | ) |
|
Obtain the lock for writing
- Parameters
-
◆ ReleaseDualLock()
Safely release two simultaneous locks
- Parameters
-
lock_1 | pointer to the first lock |
how_1 | first lock's type |
lock_2 | pointer to the second lock |
how_2 | second lock's type |
◆ ReleaseReadLock()
void ReleaseReadLock |
( |
struct Lock * |
lock | ) |
|
Release the lock obtained for reading
- Parameters
-
◆ ReleaseSharedLock()
void ReleaseSharedLock |
( |
struct Lock * |
lock | ) |
|
Release the lock obtained as a shared lock
- Parameters
-
◆ ReleaseWriteLock()
void ReleaseWriteLock |
( |
struct Lock * |
lock | ) |
|
Release the lock obtained for writing
- Parameters
-
◆ WriteLocked()
int WriteLocked |
( |
struct Lock * |
lock | ) |
|
Check if the lock was acquired for reading
- Parameters
-
- Returns
- true (different than zero) if the lock is currently acquired for writing or as a shared lock. 0 otherwise.