Once.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
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   } // namespace thread
00059 } // namespace zypp
00061 
00062 #endif // ZYPP_THREAD_ONCE_H
00063 /*
00064 ** vim: set ts=2 sts=2 sw=2 ai et:
00065 */

doxygen