diff options
Diffstat (limited to 'src/google/protobuf/stubs/once.h')
-rw-r--r-- | src/google/protobuf/stubs/once.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/google/protobuf/stubs/once.h b/src/google/protobuf/stubs/once.h index 22b0d4e..0dee407 100644 --- a/src/google/protobuf/stubs/once.h +++ b/src/google/protobuf/stubs/once.h @@ -38,13 +38,13 @@ // This is basically a portable version of pthread_once(). // // This header declares three things: -// * A type called GoogleOnceType. +// * A type called ProtobufOnceType. // * A macro GOOGLE_PROTOBUF_DECLARE_ONCE() which declares a variable of type -// GoogleOnceType. This is the only legal way to declare such a variable. +// ProtobufOnceType. This is the only legal way to declare such a variable. // The macro may only be used at the global scope (you cannot create local // or class member variables of this type). -// * A function GogoleOnceInit(GoogleOnceType* once, void (*init_func)()). -// This function, when invoked multiple times given the same GoogleOnceType +// * A function GogoleOnceInit(ProtobufOnceType* once, void (*init_func)()). +// This function, when invoked multiple times given the same ProtobufOnceType // object, will invoke init_func on the first call only, and will make sure // none of the calls return before that first call to init_func has finished. // @@ -83,21 +83,21 @@ namespace protobuf { #ifdef _WIN32 -struct GoogleOnceInternal; +struct ProtobufOnceInternal; -struct LIBPROTOBUF_EXPORT GoogleOnceType { - GoogleOnceType(); - ~GoogleOnceType(); +struct LIBPROTOBUF_EXPORT ProtobufOnceType { + ProtobufOnceType(); + ~ProtobufOnceType(); void Init(void (*init_func)()); volatile bool initialized_; - GoogleOnceInternal* internal_; + ProtobufOnceInternal* internal_; }; #define GOOGLE_PROTOBUF_DECLARE_ONCE(NAME) \ - ::google::protobuf::GoogleOnceType NAME + ::google::protobuf::ProtobufOnceType NAME -inline void GoogleOnceInit(GoogleOnceType* once, void (*init_func)()) { +inline void GoogleOnceInit(ProtobufOnceType* once, void (*init_func)()) { // Note: Double-checked locking is safe on x86. if (!once->initialized_) { once->Init(init_func); @@ -106,12 +106,12 @@ inline void GoogleOnceInit(GoogleOnceType* once, void (*init_func)()) { #else -typedef pthread_once_t GoogleOnceType; +typedef pthread_once_t ProtobufOnceType; #define GOOGLE_PROTOBUF_DECLARE_ONCE(NAME) \ pthread_once_t NAME = PTHREAD_ONCE_INIT -inline void GoogleOnceInit(GoogleOnceType* once, void (*init_func)()) { +inline void GoogleOnceInit(ProtobufOnceType* once, void (*init_func)()) { pthread_once(once, init_func); } |