Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Issue 1150563002: base/threading: Lazy thread startup for pthreads (Closed)

Created:
5 years, 7 months ago by Takashi Toyoshima
Modified:
5 years, 4 months ago
Reviewers:
kinuko, Lei Zhang
CC:
chromium-reviews, piman+watch_chromium.org, erikwright+watch_chromium.org, kinuko
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

base/threading: Lazy thread startup for pthreads r331235 made it possible to initialize MessageLoop lazily. But, on platforms that depends on pthreads, thread creation still blocks until the newly created thread has started. This patch stop waiting for the new thread starts. This got to be possible because I removed thread ID from PlatformThreadHandle. (crbug.com/468793) BUG=495097 Committed: https://crrev.com/f6a0438a244d491682cdf10d612374e6d3f36dbc Cr-Commit-Position: refs/heads/master@{#340746}

Patch Set 1 : try #

Patch Set 2 : fix win/mac build errors #

Patch Set 3 : retry #

Patch Set 4 : v2 (based on ToT for try) #

Patch Set 5 : (rebase to show diffs to 1207823004) #

Patch Set 6 : rebase, and do not use private handle_ #

Total comments: 4

Patch Set 7 : review #8, #9 #

Total comments: 1

Patch Set 8 : rebased #

Total comments: 6

Patch Set 9 : rebase and review #15 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+18 lines, -45 lines) Patch
M base/threading/platform_thread_posix.cc View 1 2 3 4 5 6 7 8 7 chunks +18 lines, -45 lines 1 comment Download

Messages

Total messages: 24 (8 generated)
Takashi Toyoshima
Still have problems. I will split some trivial cleanup parts to land it separately.
5 years, 6 months ago (2015-05-29 07:16:36 UTC) #4
Takashi Toyoshima
Now it's getting to be a easy fix after series of changes for base/threading. Still ...
5 years, 5 months ago (2015-06-30 11:25:50 UTC) #7
Takashi Toyoshima
https://codereview.chromium.org/1150563002/diff/180001/base/threading/platform_thread_posix.cc File base/threading/platform_thread_posix.cc (right): https://codereview.chromium.org/1150563002/diff/180001/base/threading/platform_thread_posix.cc#newcode109 base/threading/platform_thread_posix.cc:109: // Value of |thread_handle| is undefined if pthread_create fails. ...
5 years, 5 months ago (2015-07-02 13:57:50 UTC) #8
kinuko
https://codereview.chromium.org/1150563002/diff/180001/base/threading/platform_thread_posix.cc File base/threading/platform_thread_posix.cc (right): https://codereview.chromium.org/1150563002/diff/180001/base/threading/platform_thread_posix.cc#newcode107 base/threading/platform_thread_posix.cc:107: ALLOW_UNUSED_LOCAL(unused_params); nit: ignore_result(param.release()) would work
5 years, 5 months ago (2015-07-02 14:23:35 UTC) #9
Takashi Toyoshima
https://codereview.chromium.org/1150563002/diff/180001/base/threading/platform_thread_posix.cc File base/threading/platform_thread_posix.cc (right): https://codereview.chromium.org/1150563002/diff/180001/base/threading/platform_thread_posix.cc#newcode107 base/threading/platform_thread_posix.cc:107: ALLOW_UNUSED_LOCAL(unused_params); On 2015/07/02 14:23:35, kinuko wrote: > nit: ignore_result(param.release()) ...
5 years, 5 months ago (2015-07-03 04:31:35 UTC) #10
Takashi Toyoshima
Note from reviews for https://chromiumcodereview.appspot.com/1207823004/ https://chromiumcodereview.appspot.com/1150563002/diff/200001/base/threading/platform_thread_posix.cc File base/threading/platform_thread_posix.cc (right): https://chromiumcodereview.appspot.com/1150563002/diff/200001/base/threading/platform_thread_posix.cc#newcode191 base/threading/platform_thread_posix.cc:191: base::ThreadRestrictions::ScopedAllowWait allow_wait; Note: remove ...
5 years, 5 months ago (2015-07-20 13:42:41 UTC) #11
Takashi Toyoshima
Now all dependent patches were submitted. PTAL Patch Set 8? I will submit https://codereview.chromium.org/1259603002/ firstly ...
5 years, 4 months ago (2015-07-24 14:13:03 UTC) #12
Takashi Toyoshima
+thestig for base/ OWNERS review.
5 years, 4 months ago (2015-07-28 03:32:39 UTC) #14
Lei Zhang
https://chromiumcodereview.appspot.com/1150563002/diff/220001/base/threading/platform_thread_posix.cc File base/threading/platform_thread_posix.cc (left): https://chromiumcodereview.appspot.com/1150563002/diff/220001/base/threading/platform_thread_posix.cc#oldcode50 base/threading/platform_thread_posix.cc:50: WaitableEvent handle_set; I think you can remove #include base/synchronization/waitable_event.h ...
5 years, 4 months ago (2015-07-28 06:32:55 UTC) #15
Takashi Toyoshima
PTAL https://codereview.chromium.org/1150563002/diff/220001/base/threading/platform_thread_posix.cc File base/threading/platform_thread_posix.cc (left): https://codereview.chromium.org/1150563002/diff/220001/base/threading/platform_thread_posix.cc#oldcode50 base/threading/platform_thread_posix.cc:50: WaitableEvent handle_set; On 2015/07/28 06:32:55, Lei Zhang wrote: ...
5 years, 4 months ago (2015-07-28 11:13:44 UTC) #17
Lei Zhang
lgtm
5 years, 4 months ago (2015-07-28 18:07:05 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1150563002/260001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1150563002/260001
5 years, 4 months ago (2015-07-28 18:07:31 UTC) #20
commit-bot: I haz the power
Committed patchset #9 (id:260001)
5 years, 4 months ago (2015-07-28 19:21:58 UTC) #21
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/f6a0438a244d491682cdf10d612374e6d3f36dbc Cr-Commit-Position: refs/heads/master@{#340746}
5 years, 4 months ago (2015-07-28 19:22:55 UTC) #22
Dmitry Skiba
https://codereview.chromium.org/1150563002/diff/260001/base/threading/platform_thread_posix.cc File base/threading/platform_thread_posix.cc (right): https://codereview.chromium.org/1150563002/diff/260001/base/threading/platform_thread_posix.cc#newcode46 base/threading/platform_thread_posix.cc:46: scoped_ptr<ThreadParams> thread_params(static_cast<ThreadParams*>(params)); Just curious - do we support calling ...
5 years, 4 months ago (2015-07-28 21:33:41 UTC) #23
Lei Zhang
5 years, 4 months ago (2015-07-28 22:51:39 UTC) #24
Message was sent while issue was closed.
On 2015/07/28 21:33:41, Dmitry Skiba wrote:
>
https://codereview.chromium.org/1150563002/diff/260001/base/threading/platfor...
> File base/threading/platform_thread_posix.cc (right):
> 
>
https://codereview.chromium.org/1150563002/diff/260001/base/threading/platfor...
> base/threading/platform_thread_posix.cc:46: scoped_ptr<ThreadParams>
> thread_params(static_cast<ThreadParams*>(params));
> Just curious - do we support calling pthread_exit()?
> Even if not, I would play safe and copy params to a local / delete params
before
> doing anything else.

Is your concern that some thread may call pthread_exit(), and cause the
scoped_ptr to fail to delete |params| on the newly created thread?

BTW, I'm seeing an issue with Valgrind here:
https://code.google.com/p/chromium/issues/detail?id=514868

Powered by Google App Engine
This is Rietveld 408576698