src/utest/utestThread.cpp
void ThreadTest::testMutexRecursion()
{
    ts::Mutex mutex;

    TSUNIT_ASSERT(!mutex.release());

    TSUNIT_ASSERT(mutex.acquire());
    TSUNIT_ASSERT(mutex.acquire());
    TSUNIT_ASSERT(mutex.acquire());

    TSUNIT_ASSERT(mutex.release());
    TSUNIT_ASSERT(mutex.release());
    TSUNIT_ASSERT(mutex.release());

    TSUNIT_ASSERT(!mutex.release());
    TSUNIT_ASSERT(!mutex.release());
}
//
// Test case: Check mutex recursion
//
Test case: Check mutex recursion
Test case : Check mutex recursion
void ThreadTest::testMutexRecursion()
{
    ts::Mutex mutex;
    TSUNIT_ASSERT(!mutex.release());
    TSUNIT_ASSERT(mutex.acquire());
    TSUNIT_ASSERT(mutex.acquire());
    TSUNIT_ASSERT(mutex.acquire());
    TSUNIT_ASSERT(mutex.release());
    TSUNIT_ASSERT(mutex.release());
    TSUNIT_ASSERT(mutex.release());
    TSUNIT_ASSERT(!mutex.release());
    TSUNIT_ASSERT(!mutex.release());
}
void ThreadTest :: testMutexRecursion ( ) { ts :: Mutex mutex ; TSUNIT_ASSERT ( ! mutex . release ( ) ) ; TSUNIT_ASSERT ( mutex . acquire ( ) ) ; TSUNIT_ASSERT ( mutex . acquire ( ) ) ; TSUNIT_ASSERT ( mutex . acquire ( ) ) ; TSUNIT_ASSERT ( mutex . release ( ) ) ; TSUNIT_ASSERT ( mutex . release ( ) ) ; TSUNIT_ASSERT ( mutex . release ( ) ) ; TSUNIT_ASSERT ( ! mutex . release ( ) ) ; TSUNIT_ASSERT ( ! mutex . release ( ) ) ; }
Test case: Check mutex recursion
Test case : Check mutex recursion