Once.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00012 #ifndef ZYPP_THREAD_ONCE_H
00013 #define ZYPP_THREAD_ONCE_H
00014
00015 #include <pthread.h>
00016
00017
00019 namespace zypp
00020 {
00021
00022 namespace thread
00023 {
00024
00025
00027 #define ZYPP_ONCE_INIT PTHREAD_ONCE_INIT
00028
00029
00032 typedef pthread_once_t OnceFlag;
00033
00034
00048 void callOnce(OnceFlag& flag, void (*func)());
00049
00050 inline void callOnce(OnceFlag& flag, void (*func)())
00051 {
00052 pthread_once(&flag, func);
00053 }
00054
00056 }
00059 }
00061
00062 #endif // ZYPP_THREAD_ONCE_H
00063
00064
00065