Apps     Components     Interfaces     All Files     Source Tree     source: tos.lib.VM.interfaces.BombillaLocks.nc

Interface: BombillaLocks

Interface for Bombilla lock accessors and mutators.

Components providing this interface:
tos.lib.VM.components.BLocksProxy
tos.lib.VM.components.BLocksSafe

Components requiring this interface:
tos.lib.VM.components.BContextSynch
tos.lib.VM.opcodes.OPgetsetvar4M

Commands

Commands - Details

lock

result_t lock(BombillaContext *context, uint8_t lockNum)

Lock the specified lock on behalf of a context. Does not perform bounds checks.

Parameters:

context - The locking context.

locks - An array of locks.

lockNum - Which lock in the array to lock.

Returns: SUCCESS if the lock is successfully locked, FAIL otherwise.

unlock

result_t unlock(BombillaContext *context, uint8_t lockNum)

Unlock the specified lock on behalf of a context. Does not perform bounds checks. The specified lock must be held by context for this operation to succeed.

Parameters:

context - The unlocking context.

locks - An array of locks.

lockNum - Which lock in the array to unlock.

Returns: SUCCESS if the lock is successfully unlocked, FAIL otherwise.

isLocked

bool isLocked(uint8_t lockNum)

Whether a lock is locked or not. Does not perform bounds checks.

Parameters:

locks - An array of locks.

lockNum - Which lock in the array to check.

Returns: TRUE if locked, FALSE if unlocked.

isHeldBy

bool isHeldBy(uint8_t lockNum, BombillaContext *context)

Whether a lock is held by a certain context.

Parameters:

locks - An array of locks.

lockNum - Which lock in the array to check.

context - The context whose ownership is being queried.

Returns: TRUE if the lock is held by context, FALSE otherwise.