cyg_mutex_init
Name: cyg_mutex_init ( ) - initialize a mutex
Synopsis:
void cyg_mutex_init
(
  cyg_mutex_t *mutex /* mutex to initialize */
)
Description: This initializes a mutex for use. Note that mutexes under eCos cannot be locked multiple times by the same thread. If a thread locks the same mutex multiple times the behavior is undefined.
Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_mutex_destroy

cyg_mutex_destroy
Name: cyg_mutex_destroy ( ) - destroy (invalidate) a mutex
Synopsis:
void cyg_mutex_destroy
(
  cyg_mutex_t *mutex /* mutex to destroy (invalidate) */
)
Description: This destroys (invalidates) a mutex. Be careful not to destroy a mutex that other threads are waiting on or is otherwise in use. If you destroy a mutex that is in use, you risk deadlocking the system.
Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_mutex_init

cyg_mutex_lock
Name: cyg_mutex_lock ( ) - lock a mutex or wait to lock one
Synopsis:
cyg_bool_t cyg_mutex_lock
(
  cyg_mutex_t *mutex /* mutex to lock */
)
Description: This locks a mutex. If the mutex is not available, the thread will be blocked until the mutex is available or the thread is awaken by a signal.
Include: #include <cyg/kernel/kapi.h>
Returns: "true" if the mutex was locked, "false" otherwise.
See Also: cyg_mutex_trylock, cyg_mutex_unlock, cyg_mutex_release

cyg_mutex_trylock
Name: cyg_mutex_trylock ( ) - attempt to lock a mutex
Synopsis:
cyg_bool_t cyg_mutex_trylock
(
  cyg_mutex_t *mutex /* mutex to attempt lock */
)
Description: This locks a mutex. If the mutex is not available, an error is is returned.
Include: #include <cyg/kernel/kapi.h>
Returns: "true" if the mutex was locked, "false" if the mutex couldn't be locked.
See Also: cyg_mutex_lock, cyg_mutex_unlock, cyg_mutex_release

cyg_mutex_unlock
Name: cyg_mutex_unlock ( ) - unlocks a mutex
Synopsis:
void cyg_mutex_unlock
(
  cyg_mutex_t *mutex /* mutex to unlock */
)
Description: This unlocks a mutex. Note that it is undefined behavior to unlock a mutex that is in an unlocked state, or to unlock a mutex that was locked by another thread.
Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_mutex_lock, cyg_mutex_trylock, cyg_mutex_release

cyg_mutex_release
Name: cyg_mutex_release ( ) - release all threads waiting on a mutex
Synopsis:
void cyg_mutex_release
(
  cyg_mutex_t *mutex /* mutex to release */
)
Description: This releases all threads waiting on a mutex. All threads that were waiting on the mutex will be receive an error condition indicating that the mutex was not acquired.
Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_mutex_lock, cyg_mutex_trylock, cyg_mutex_unlock

cyg_mutex_set_ceiling
Name: cyg_mutex_set_ceiling ( ) - set ceiling priority of mutex
Synopsis:
void cyg_mutex_set_ceiling
(
  cyg_mutex_t    *mutex,  /* mutex to set ceiling of */
  cyg_priority_t priority /* ceiling priority        */
)
Description: This sets the ceiling priority of a thread that acquires the given mutex. This is only meaningful if the protocol of the mutex is set to CYG_MUTEX_CEILING. Mutexes with ceilings cause the thread that has acquired the mutex to inherit the ceiling priority temporarily to avoid deadlocks.
Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_mutex_set_protocol

cyg_mutex_set_protocol
Name: cyg_mutex_set_protocol ( ) - set the protocol of a mutex
Synopsis:
void cyg_mutex_set_protocol
(
  cyg_mutex_t             *mutex,  /* mutex to set protocol of */
  enum cyg_mutex_protocol protocol /* protocol to use          */
)
Description: This sets the protocol of a mutex. The following protocols are valid:

CYG_MUTEX_NONE - no priority inheritance

CYG_MUTEX_INHERIT - inherit priority of thread currently holding mutex

CYG_MUTEX_CEILING - inherit ceiling priority of mutex

A priority will only be inherited if it causes the thread holding the mutex to go up in priority.

Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_mutex_set_ceiling