Cyg_Mutex::Cyg_Mutex | |
Name: | Cyg_Mutex::Cyg_Mutex ( ) - create a mutex |
---|---|
Synopsis: | Cyg_Mutex::Cyg_Mutex ( void ) |
Description: | Creates a mutex. The mutex is created in an unlocked state. If the kernel was compiled without priority inversion the effective protocol is Cyg_Mutex::NONE. If the kernel was compiled with priority inversion enabled, the protocol of the mutex depends on how the kernel was compiled. More data will be forthcoming on this in later revisions of the documentation. It is probably best to use the other Cyg_Mutex constructor explicitly if priority inversion is enabled. |
Include: | #include <cyg/kernel/mutex.hxx> |
Returns: | nothing |
See Also: | Cyg_Mutex::~Cyg_Mutex |
Cyg_Mutex::Cyg_Mutex | |
Name: | Cyg_Mutex::Cyg_Mutex ( ) - create a mutex with a specified protocol |
---|---|
Synopsis: | Cyg_Mutex::Cyg_Mutex ( cyg_protcol protocol /* priority inheritence protocol */ ) |
Description: | Creates a mutex with a protocol. Cyg_Mutex::NONE, Cyg_Mutex::INHERIT, or Cyg_Mutex::CEILING are the possible values. This is only valid if the kernel is compiled to support priority inversion. |
Include: | #include <cyg/kernel/mutex.hxx> |
Returns: | nothing |
See Also: | Cyg_Mutex::~Cyg_Mutex, Cyg_Mutex::set_protocol |
Cyg_Mutex::~Cyg_Mutex | |
Name: | Cyg_Mutex::~Cyg_Mutex ( ) - destroy a mutex |
---|---|
Synopsis: | Cyg_Mutex::~Cyg_Mutex ( void ) |
Description: | Destroys a mutex. If other threads are waiting for this mutex they will not be released, so be sure that no threads are waiting on this mutex before destroying it. |
Include: | #include <cyg/kernel/mutex.hxx> |
Returns: | nothing |
See Also: | Cyg_Mutex::Cyg_Mutex |
Cyg_Mutex::lock | |
Name: | Cyg_Mutex::lock ( ) - lock a mutex or wait until it can be locked |
---|---|
Synopsis: | cyg_bool Cyg_Mutex::lock ( void ) |
Description: | Locks a mutex. If the mutex is not available this will wait until the mutex is free. Note that only the owner of a locked mutex can release it. |
Include: | #include <cyg/kernel/mutex.hxx> |
Returns: | "true" if the mutex was locked by the calling thread "false" if the mutex could not be locked. |
See Also: | Cyg_Mutex::trylock, Cyg_Mutex::unlock, Cyg_Mutex::release, Cyg_Mutex::get_owner |
Cyg_Mutex::trylock | |
Name: | Cyg_Mutex::trylock ( ) - lock a mutex if it's free |
---|---|
Synopsis: | cyg_bool Cyg_Mutex::trylock ( void ) |
Description: | Locks a mutex only if it's free. If the mutex is not available this call will return immediately. |
Include: | #include <cyg/kernel/mutex.hxx> |
Returns: | "true" if the mutex was locked by the calling thread "false" if the mutex could not be locked or has been allocated by another thread. |
See Also: | Cyg_Mutex::lock, Cyg_Mutex::unlock, Cyg_Mutex::release, Cyg_Mutex::get_owner |
Cyg_Mutex::unlock | |
Name: | Cyg_Mutex::unlock ( ) - unlock a mutex |
---|---|
Synopsis: | void Cyg_Mutex::unlock ( void ) |
Description: | Unlocks a mutex that was previously allocated by the calling thread. If the calling thread is not the owner, the behavior is undefined. |
Include: | #include <cyg/kernel/mutex.hxx> |
Returns: | nothing |
See Also: | Cyg_Mutex::trylock, Cyg_Mutex::lock, Cyg_Mutex::release |
Cyg_Mutex::release | |
Name: | Cyg_Mutex::release ( ) - release all threads waiting on a mutex |
---|---|
Synopsis: | void Cyg_Mutex::release ( void ) |
Description: | Releases all threads waiting on a mutex. Any thread that is waiting on the mutex will not receive ownership of the mutex but will return an error if they are waiting on the mutex. |
Include: | #include <cyg/kernel/mutex.hxx> |
Returns: | nothing |
See Also: | Cyg_Mutex::trylock, Cyg_Mutex::lock, Cyg_Mutex::unlock |
Cyg_Mutex::set_ceiling | |
Name: | Cyg_Mutex::set_ceiling ( ) - set the max priority to be inherited |
---|---|
Synopsis: | void Cyg_Mutex::set_ceiling ( cyg_priority priority /* ceiling priority */ ) |
Description: | Set the priority ceiling of the mutex. If this mutex has the protocol of Cyg_Mutex::CEILING any thread that owns this mutex will have it's priority temporarily set to the value specified here. It's a good idea to use this function if you use priority inheritence. The kernel will support default values, and it's typically 0, but it's good programming practice to explicity set it in your application software. |
Include: | #include <cyg/kernel/mutex.hxx> |
Returns: | nothing |
See Also: | Cyg_Mutex::get_ceiling |
Cyg_Mutex::get_ceiling | |
Name: | Cyg_Mutex::get_ceiling ( ) - get the priority ceiling of this mutex |
---|---|
Synopsis: | cyg_priority Cyg_Mutex::get_ceiling ( void ) |
Description: | This gets the priority ceiling of the mutex. This is only meaningful if the protocol of the mutex is of type Cyg_Mutex::CEILING. |
Include: | #include <cyg/kernel/mutex.hxx> |
Returns: | the priority ceiling of the mutex. |
See Also: | Cyg_Mutex::set_ceiling |
Cyg_Mutex::get_owner | |
Name: | Cyg_Mutex::get_owner ( ) - get the current owner of a mutex |
---|---|
Synopsis: | Cyg_Thread *Cyg_Mutex::get_owner ( void ) |
Description: | Gets the current owner of the mutex. |
Include: | #include <cyg/kernel/mutex.hxx> |
Returns: | a Cyg_Thread pointer to the current owner of the mutex or NULL if the mutex is not owned by anybody. |
See Also: | Cyg_Mutex::lock, Cyg_Mutex::trylock |
Cyg_Mutex::set_protocol | |
Name: | Cyg_Mutex::set_protocol ( ) - set the protocol of a mutex |
---|---|
Synopsis: | void Cyg_Mutex::set_protocol ( cyg_protcol new_protocol ) |
Description: | This sets the protocol of a mutex. Valid values are Cyg_Mutex::NONE, Cyg_Mutex::INHERIT or Cyg_Mutex::CEILING. Cyg_Mutex::NONE, no priority inheritance Cyg_Mutex::INHERIT, inherit priority of thread currently holding mutex Cyg_Mutex::CEILING, inherit ceiling priority of mutex |
Include: | #include <cyg/kernel/mutex.hxx> |
Returns: | nothing |
See Also: | Cyg_Mutex::Cyg_Mutex, Cyg_Mutex::set_ceiling, Cyg_Mutex::get_ceiling |