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

Side by Side Diff: mojo/edk/system/core.cc

Issue 2075353002: Plumb the handle signals state out of Waiter::Wait(). (Closed) Base URL: https://github.com/domokit/mojo.git@work795_wait_set_4.3-x-work794_wait_set_4.2
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/edk/system/core.h" 5 #include "mojo/edk/system/core.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 if (result != MOJO_RESULT_OK) { 796 if (result != MOJO_RESULT_OK) {
797 *result_index = i; 797 *result_index = i;
798 break; 798 break;
799 } 799 }
800 } 800 }
801 uint32_t num_added = i; 801 uint32_t num_added = i;
802 802
803 if (result == MOJO_RESULT_ALREADY_EXISTS) 803 if (result == MOJO_RESULT_ALREADY_EXISTS)
804 result = MOJO_RESULT_OK; // The i-th one is already "triggered". 804 result = MOJO_RESULT_OK; // The i-th one is already "triggered".
805 else if (result == MOJO_RESULT_OK) 805 else if (result == MOJO_RESULT_OK)
806 result = waiter.Wait(deadline, result_index); 806 result = waiter.Wait(deadline, result_index, nullptr);
807 807
808 // Make sure no other dispatchers try to wake |waiter| for the current 808 // Make sure no other dispatchers try to wake |waiter| for the current
809 // |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be 809 // |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be
810 // destroyed, but this would still be required if the waiter were in TLS.) 810 // destroyed, but this would still be required if the waiter were in TLS.)
811 for (i = 0; i < num_added; i++) { 811 for (i = 0; i < num_added; i++) {
812 dispatchers[i]->RemoveAwakable( 812 dispatchers[i]->RemoveAwakable(
813 &waiter, signals_states ? &signals_states[i] : nullptr); 813 &waiter, signals_states ? &signals_states[i] : nullptr);
814 } 814 }
815 if (signals_states) { 815 if (signals_states) {
816 for (; i < num_handles; i++) 816 for (; i < num_handles; i++)
817 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); 817 signals_states[i] = dispatchers[i]->GetHandleSignalsState();
818 } 818 }
819 819
820 return result; 820 return result;
821 } 821 }
822 822
823 } // namespace system 823 } // namespace system
824 } // namespace mojo 824 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698