libzypp  11.13.5
Once.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_THREAD_ONCE_H
13 #define ZYPP_THREAD_ONCE_H
14 
15 #include <pthread.h>
16 
17 
19 namespace zypp
20 {
21 
22  namespace thread
23  {
24 
25 
27  #define ZYPP_ONCE_INIT PTHREAD_ONCE_INIT
28 
29 
32  typedef pthread_once_t OnceFlag;
33 
34 
48  void callOnce(OnceFlag& flag, void (*func)());
49 
50  inline void callOnce(OnceFlag& flag, void (*func)())
51  {
52  pthread_once(&flag, func);
53  }
54 
56  } // namespace thread
59 } // namespace zypp
61 
62 #endif // ZYPP_THREAD_ONCE_H
63 /*
64 ** vim: set ts=2 sts=2 sw=2 ai et:
65 */