diff options
author | rnk@chromium.org <rnk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 01:17:14 +0000 |
---|---|---|
committer | rnk@chromium.org <rnk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 01:17:14 +0000 |
commit | f4b43912285085167847cc9b8a409e4650711469 (patch) | |
tree | d23daed5db89f7ca40b5874e29d85445c9e683ca /base | |
parent | 9d56ae381af9ab09e631a7bc310d7c8cb17d5345 (diff) | |
download | chromium_src-f4b43912285085167847cc9b8a409e4650711469.zip chromium_src-f4b43912285085167847cc9b8a409e4650711469.tar.gz chromium_src-f4b43912285085167847cc9b8a409e4650711469.tar.bz2 |
Log errno if pthread_create() fails
Most callers of PlatformThread::CreateThread() don't check for success,
so returning false winds up with silent hangs. Logging something makes
the problem more apparent.
R=mark@chromium.org
Review URL: https://chromiumcodereview.appspot.com/12461015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/threading/platform_thread_posix.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc index 7d62bdf..0fb2a8a 100644 --- a/base/threading/platform_thread_posix.cc +++ b/base/threading/platform_thread_posix.cc @@ -161,7 +161,12 @@ bool CreateThread(size_t stack_size, bool joinable, params->joinable = joinable; params->priority = priority; - success = !pthread_create(thread_handle, &attributes, ThreadFunc, params); + int err = pthread_create(thread_handle, &attributes, ThreadFunc, params); + success = !err; + if (!success) { + errno = err; + PLOG(ERROR) << "pthread_create"; + } pthread_attr_destroy(&attributes); if (!success) |