Base Framework
Public Member Functions | List of all members
Once Class Reference

Once synchronization object. More...

#include <base/concurrency/Once.h>

Inherits AutomationObject.

Public Member Functions

 Once () noexcept
 
bool getToken ()
 
void relinquishToken () noexcept
 

Detailed Description

Once synchronization object.

Once implementation with delayed resource allocation.

void myMethod() noexcept
{
static Once once;
if (once.getToken()) {
// ...
}
}
See also
Event MutualExclusion Semaphore
Version
1.0

Constructor & Destructor Documentation

◆ Once()

Once::Once ( )
noexcept

Initializes the synchronization object.

Member Function Documentation

◆ getToken()

bool Once::getToken ( )
inline

This method returns true for one thread only and only on the first invocation. All other threads are blocked until relinquishToken() is invoked by the thread for which getToken() returned true. Raises ResourceException if unable to allocate the required resources.

◆ relinquishToken()

void Once::relinquishToken ( )
noexcept

Relinquishes the token.

Once::relinquishToken
void relinquishToken() noexcept
Once
Once synchronization object.
Definition: Once.h:42
Once::getToken
bool getToken()
Definition: Once.h:83