Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
ThreadMutex Struct Reference

Detailed Description

A mutual exclusion class.

See also
ThreadLock, ThreadReleaseLock and Dispatcher Mutex

#include <ThreadLib.h>

Inherits ThreadMutexBase.

Public Member Functions

 ThreadMutex ()
 Initialize target mutex resources (C: ThreadMutex_constructor). More...
 
 ~ThreadMutex ()
 Release target resources after all owners and waiters have stopped (C: ThreadMutex_destructor). More...
 
void set ()
 Wait until the mutex can be acquired (C: ThreadMutex_set). More...
 
void release ()
 Release a mutex owned by this thread (C: ThreadMutex_release). More...
 
bool isOwner ()
 

Constructor & Destructor Documentation

◆ ThreadMutex()

ThreadMutex::ThreadMutex ( )

Initialize target mutex resources (C: ThreadMutex_constructor).

Resource-failure handling is port-specific; no status is returned.

◆ ~ThreadMutex()

ThreadMutex::~ThreadMutex ( )

Release target resources after all owners and waiters have stopped (C: ThreadMutex_destructor).

Do not destroy a locked/in-use mutex.

Member Function Documentation

◆ isOwner()

bool ThreadMutex::isOwner ( )
Returns
True if the current thread owns the mutex, false otherwise. C equivalent: ThreadMutex_isOwner. This is an ownership check, not a test that another thread can safely acquire the mutex.

◆ release()

void ThreadMutex::release ( )

Release a mutex owned by this thread (C: ThreadMutex_release).

Calling from another thread or without acquisition is incorrect usage.

◆ set()

void ThreadMutex::set ( )

Wait until the mutex can be acquired (C: ThreadMutex_set).

Do not recursively acquire it; portability requires one matching release.