summaryrefslogtreecommitdiffstats
path: root/base/threading/platform_thread_posix.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/threading/platform_thread_posix.cc')
-rw-r--r--base/threading/platform_thread_posix.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc
index 421830e..5b609c1 100644
--- a/base/threading/platform_thread_posix.cc
+++ b/base/threading/platform_thread_posix.cc
@@ -116,13 +116,15 @@ bool CreateThread(size_t stack_size, bool joinable,
params.priority = priority;
params.handle = thread_handle;
- pthread_t handle = 0;
+ pthread_t handle;
int err = pthread_create(&handle,
&attributes,
ThreadFunc,
&params);
success = !err;
if (!success) {
+ // Value of |handle| is undefined if pthread_create fails.
+ handle = 0;
errno = err;
PLOG(ERROR) << "pthread_create";
}