Introduction   API Reference   Examples   Index  

L4 Lock API

Documentation of the L4 Lock API. More...

Defines

#define L4LOCK_LOCKED_INITIALIZER(t)   {(L4SEMAPHORE_LOCKED_INITIALIZER),(t),1}
 Lock initializer (locked), use to initialize locks in nested structures.
#define L4LOCK_LOCKED(t)   ((l4lock_t) L4LOCK_LOCKED_INITIALIZER(t))
 Lock value (locked), use to initialize plain lock variables.
#define L4LOCK_UNLOCKED_INITIALIZER   {L4SEMAPHORE_UNLOCKED_INITIALIZER, (L4THREAD_INVALID_ID),0}
 Lock initializer (unlocked), use to initialize locks in nested structures.
#define L4LOCK_UNLOCKED   ((l4lock_t) L4LOCK_UNLOCKED_INITIALIZER)
 Lock value (unlocked), use to initialize plain lock variables.

Typedefs

typedef struct l4lock l4lock_t
 Lock type.

Functions

L4_INLINE void l4lock_lock (l4lock_t *lock)
 Occupy lock.
L4_INLINE int l4lock_try_lock (l4lock_t *lock)
 Try to occupy lock, return error if lock already owned by someone else.
L4_INLINE void l4lock_unlock (l4lock_t *lock)
 Release lock.
L4_INLINE l4thread_t l4lock_owner (const l4lock_t *lock)
 Return lock owner.

Detailed Description

Documentation of the L4 Lock API.


Define Documentation

#define L4LOCK_LOCKED_INITIALIZER (  )     {(L4SEMAPHORE_LOCKED_INITIALIZER),(t),1}

Lock initializer (locked), use to initialize locks in nested structures.

Parameters:
t Initial owner of the lock

Definition at line 54 of file types.h.

#define L4LOCK_LOCKED (  )     ((l4lock_t) L4LOCK_LOCKED_INITIALIZER(t))

Lock value (locked), use to initialize plain lock variables.

Parameters:
t Initial owner of the lock

Definition at line 62 of file types.h.

#define L4LOCK_UNLOCKED_INITIALIZER   {L4SEMAPHORE_UNLOCKED_INITIALIZER, (L4THREAD_INVALID_ID),0}

Lock initializer (unlocked), use to initialize locks in nested structures.

Definition at line 69 of file types.h.

#define L4LOCK_UNLOCKED   ((l4lock_t) L4LOCK_UNLOCKED_INITIALIZER)

Lock value (unlocked), use to initialize plain lock variables.

Definition at line 76 of file types.h.


Typedef Documentation

typedef struct l4lock l4lock_t

Lock type.

Definition at line 40 of file types.h.


Function Documentation

L4_INLINE void l4lock_lock ( l4lock_t lock  ) 

Occupy lock.

Parameters:
lock Lock structure
Occupy lock, block if lock already owned by someone else.

Definition at line 96 of file lock.h.

L4_INLINE int l4lock_try_lock ( l4lock_t lock  ) 

Try to occupy lock, return error if lock already owned by someone else.

Parameters:
lock Lock structure
Returns:
1 on success (occupied lock or lack already owned by calling thread), 0 if lock owned by someone else

Definition at line 123 of file lock.h.

L4_INLINE void l4lock_unlock ( l4lock_t lock  ) 

Release lock.

Parameters:
lock Lock structure.

Definition at line 156 of file lock.h.

L4_INLINE l4thread_t l4lock_owner ( const l4lock_t lock  ) 

Return lock owner.

Parameters:
lock Lock structure
Returns:
Lock owner, L4THREAD_INVALID_ID if no one owns the lock

Definition at line 181 of file lock.h.


L4 Lock Reference Manual, written by Lars Reuther  © 2000-2003