libzypp  17.10.1
zypp::thread Namespace Reference


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


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


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

Typedef Documentation

◆ RecursiveMutex_t

typedef pthread_mutex_t zypp::thread::RecursiveMutex_t

Definition at line 26 of file Mutex.h.

◆ OnceFlag

typedef pthread_once_t zypp::thread::OnceFlag

The OnceFlag variable type.

Definition at line 32 of file Once.h.

Function Documentation

◆ callOnce()

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

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.