distortos  v0.4.0
object-oriented C++ RTOS for microcontrollers
distortos::test::anonymous_namespace{MutexPriorityInheritanceOperationsTestCase.cpp}::TryLockForThread Class Reference
Collaboration diagram for distortos::test::anonymous_namespace{MutexPriorityInheritanceOperationsTestCase.cpp}::TryLockForThread:
[legend]

Public Member Functions

constexpr TryLockForThread (Mutex *const unlockedMutex, Mutex &lockedMutex, const TickClock::duration duration)
 TryLockForThread's constructor. More...
 
int getRet () const
 
void operator() ()
 Main function of the thread. More...
 

Private Attributes

TickClock::duration duration_
 duration used as argument for Mutex::tryLockFor() More...
 
MutexunlockedMutex_
 pointer to unlocked mutex which will be locked with no timeout, nullptr to skip this step More...
 
MutexlockedMutex_
 reference to locked mutex on which lock attempt with timeout will be executed More...
 
int ret_
 return value of Mutex::tryLockFor() More...
 

Detailed Description

functor class used in testCanceledLock() - it locks 1 or 2 mutexes (last one with timeout) and unlocks them afterwards

Constructor & Destructor Documentation

◆ TryLockForThread()

constexpr distortos::test::anonymous_namespace{MutexPriorityInheritanceOperationsTestCase.cpp}::TryLockForThread::TryLockForThread ( Mutex *const  unlockedMutex,
Mutex lockedMutex,
const TickClock::duration  duration 
)
inline

TryLockForThread's constructor.

Parameters
[in]unlockedMutexis a pointer to unlocked mutex which will be locked with no timeout, nullptr to skip this step
[in]lockedMutexis a pointer to locked mutex on which lock attempt with timeout will be executed
[in]durationis the duration used as argument for Mutex::tryLockFor()

Member Function Documentation

◆ getRet()

int distortos::test::anonymous_namespace{MutexPriorityInheritanceOperationsTestCase.cpp}::TryLockForThread::getRet ( ) const
inline
Returns
return value of Mutex::tryLockFor()

◆ operator()()

void distortos::test::anonymous_namespace{MutexPriorityInheritanceOperationsTestCase.cpp}::TryLockForThread::operator() ( )
inline

Main function of the thread.

Following steps are performed:

  1. "unlocked mutex" is locked with no timeout (if it was provided)
  2. attempt to lock "locked mutex" with given timeout is executed
  3. if operation from step 2. succeeds (which should NOT happen), this mutex is unlocked
  4. "unlocked mutex" is unlocked (if it was provided)
Note
Values returned by operations in step 1, 3 and 4 are not checked to simplify this test.

Member Data Documentation

◆ duration_

TickClock::duration distortos::test::anonymous_namespace{MutexPriorityInheritanceOperationsTestCase.cpp}::TryLockForThread::duration_
private

duration used as argument for Mutex::tryLockFor()

◆ lockedMutex_

Mutex& distortos::test::anonymous_namespace{MutexPriorityInheritanceOperationsTestCase.cpp}::TryLockForThread::lockedMutex_
private

reference to locked mutex on which lock attempt with timeout will be executed

◆ ret_

int distortos::test::anonymous_namespace{MutexPriorityInheritanceOperationsTestCase.cpp}::TryLockForThread::ret_
private

return value of Mutex::tryLockFor()

◆ unlockedMutex_

Mutex* distortos::test::anonymous_namespace{MutexPriorityInheritanceOperationsTestCase.cpp}::TryLockForThread::unlockedMutex_
private

pointer to unlocked mutex which will be locked with no timeout, nullptr to skip this step


The documentation for this class was generated from the following file: