libzypp  13.10.6
zypp::thread Namespace Reference

Classes

class  Mutex
 A recursive Mutex. More...
 
class  MutexException
 Exception type thrown on mutex errors. More...
 
class  MutexLock
 

Typedefs

typedef pthread_mutex_t RecursiveMutex_t
 
typedef pthread_once_t OnceFlag
 The OnceFlag variable type. More...
 

Functions

void callOnce (OnceFlag &flag, void(*func)())
 Call once function. More...
 

Typedef Documentation

typedef pthread_mutex_t zypp::thread::RecursiveMutex_t

Definition at line 26 of file Mutex.h.

typedef pthread_once_t zypp::thread::OnceFlag

The OnceFlag variable type.

Definition at line 32 of file Once.h.

Function Documentation

void zypp::thread::callOnce ( OnceFlag &  flag,
void(*)()  func 
)
inline

Call once function.

The purpose of callOnce is to ensure that a piece of initialization code is executed at most once. The OnceFlag flag has to point to a static or extern variable, that was statically initialized to ZYPP_ONCE_INIT.

The first time callOnce is called with a given onceFlag argument, it calls fuct with no argument and changes the value of flag to indicate that the function has been run. Subsequent calls with the same once flag does nothing.

Definition at line 50 of file Once.h.