diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/platform_thread.h | 6 | ||||
-rw-r--r-- | base/simple_thread.h | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/base/platform_thread.h b/base/platform_thread.h index 542716b..1feb72d 100644 --- a/base/platform_thread.h +++ b/base/platform_thread.h @@ -32,8 +32,10 @@ #include "base/basictypes.h" -// PlatformThreadHandle should be a numeric type on all platforms, so it can -// be initialized to 0. However, 0 cannot be assumed to be an invalid handle. +// PlatformThreadHandle should not be assumed to be a numeric type, since the +// standard intends to allow pthread_t to be a structure. This means you +// should not initialize it to a value, like 0. If it's a member variable, the +// constructor can safely "value initialize" using () in the initializer list. #if defined(OS_WIN) typedef void* PlatformThreadHandle; // HANDLE #elif defined(OS_POSIX) diff --git a/base/simple_thread.h b/base/simple_thread.h index 44b397d..77754e9 100644 --- a/base/simple_thread.h +++ b/base/simple_thread.h @@ -98,11 +98,11 @@ class SimpleThread : public PlatformThread::Delegate { // "my_thread/321". The thread will not be created until Start() is called. SimpleThread(const Options& options, const std::string& name_prefix) : name_prefix_(name_prefix), name_(name_prefix_), options_(options), - thread_(0), event_(true, false), tid_(0), joined_(false) { } + thread_(), event_(true, false), tid_(0), joined_(false) { } SimpleThread() : name_prefix_("unnamed"), name_(name_prefix_), - thread_(0), event_(true, false), tid_(0), joined_(false) { } + thread_(), event_(true, false), tid_(0), joined_(false) { } virtual ~SimpleThread(); |