Return-Path: X-Original-To: apmail-mesos-reviews-archive@minotaur.apache.org Delivered-To: apmail-mesos-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9626A1875E for ; Sat, 7 Nov 2015 02:00:02 +0000 (UTC) Received: (qmail 6461 invoked by uid 500); 7 Nov 2015 02:00:02 -0000 Delivered-To: apmail-mesos-reviews-archive@mesos.apache.org Received: (qmail 6431 invoked by uid 500); 7 Nov 2015 02:00:02 -0000 Mailing-List: contact reviews-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@mesos.apache.org Delivered-To: mailing list reviews@mesos.apache.org Received: (qmail 6416 invoked by uid 99); 7 Nov 2015 02:00:02 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Nov 2015 02:00:02 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id D4A6127CB82; Sat, 7 Nov 2015 02:00:01 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============2175769810435378514==" MIME-Version: 1.0 Subject: Re: Review Request 39949: Document and simplify libprocess initialization synchronization logic. From: "Joseph Wu" To: "Joris Van Remoortere" , "Benjamin Hindman" , "Neil Conway" Cc: "Joseph Wu" , "mesos" , "Mesos ReviewBot" Date: Sat, 07 Nov 2015 02:00:01 -0000 Message-ID: <20151107020001.1771.65769@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: "Joseph Wu" X-ReviewGroup: mesos X-Auto-Response-Suppress: DR, RN, OOF, AutoReply X-ReviewRequest-URL: https://reviews.apache.org/r/39949/ X-Sender: "Joseph Wu" References: <20151107015012.1771.97038@reviews.apache.org> In-Reply-To: <20151107015012.1771.97038@reviews.apache.org> Reply-To: "Joseph Wu" X-ReviewRequest-Repository: mesos --===============2175769810435378514== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On Nov. 6, 2015, 5:50 p.m., Mesos ReviewBot wrote: > > Bad patch! > > > > Reviews applied: [39948] > > > > Failed command: ./support/apply-review.sh -n -r 39948 > > > > Error: > > 2015-11-07 01:50:12 URL:https://reviews.apache.org/r/39948/diff/raw/ [2087/2087] -> "39948.patch" [1] > > error: patch failed: 3rdparty/libprocess/src/process.cpp:739 > > error: 3rdparty/libprocess/src/process.cpp: patch does not apply > > Failed to apply patch Hmm... That's weird. I can apply just fine on the head commit (at the time, c68963297c9bec52cd6efb269454340b824ae931). - Joseph ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/39949/#review105561 ----------------------------------------------------------- On Nov. 6, 2015, 2:11 p.m., Joseph Wu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/39949/ > ----------------------------------------------------------- > > (Updated Nov. 6, 2015, 2:11 p.m.) > > > Review request for mesos, Benjamin Hindman, Joris Van Remoortere, and Neil Conway. > > > Bugs: MESOS-3820 > https://issues.apache.org/jira/browse/MESOS-3820 > > > Repository: mesos > > > Description > ------- > > * Renamed `initialized` to `initialize_started`. > * Renamed `initializing` to `initialize_complete`. > * Removed the (2) condition, described below: > > The initialization synchronization logic contains three conditions, which check: > 1) Was `initialize` called and is it done? > 2) Was `initialize` called and is it not done? > 3) Are you the first to call `initialize`? > > Condition (3) uses `compare_exchange_strong` between `initialized` and `false`. This returns `true` (and sets `initialized` to true) iff the caller is the first to reach that expression. > > The second simultaneous caller of `initialize` will either satisify condition (2) or (3) and then wait on `initializing`. For the second caller, (2) and (3) are identical because `compare_exchange_strong` between `true` and `false` will always return false, thereby putting the second caller into the waiting loop. > > > Diffs > ----- > > 3rdparty/libprocess/src/process.cpp a94712b9ac3b60fb047b3a5a4d84a56fa4d02313 > > Diff: https://reviews.apache.org/r/39949/diff/ > > > Testing > ------- > > `make check` > > Replaced `process::initialize();` in `3rdparty/libprocess/src/tests/main.cpp` with: > ``` > > const size_t numThreads = 50; > > std::thread* runningThreads[numThreads]; > > // Create additional threads. > for (size_t i = 0; i < numThreads; i++) { > runningThreads[i] = new std::thread([]() { > process::initialize(); > }); > } > > for (size_t i = 0; i < numThreads; i++) { > runningThreads[i]->join(); > delete runningThreads[i]; > } > ``` > (Also added `#include ` to the header). > > Rebuilt `libprocess-tests` with the modification and ran it a few times. > `3rdparty/libprocess/libprocess-tests` > > > Thanks, > > Joseph Wu > > --===============2175769810435378514==--