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

Side by Side Diff: base/synchronization/cancellation_flag.h

Issue 949293002: Implement a poor man's PostAfterStartupTask() function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | base/synchronization/cancellation_flag.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_ 5 #ifndef BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_
6 #define BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_ 6 #define BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 11 matching lines...) Expand all
22 #if !defined(NDEBUG) 22 #if !defined(NDEBUG)
23 set_on_ = PlatformThread::CurrentId(); 23 set_on_ = PlatformThread::CurrentId();
24 #endif 24 #endif
25 } 25 }
26 ~CancellationFlag() {} 26 ~CancellationFlag() {}
27 27
28 // Set the flag. May only be called on the thread which owns the object. 28 // Set the flag. May only be called on the thread which owns the object.
29 void Set(); 29 void Set();
30 bool IsSet() const; // Returns true iff the flag was set. 30 bool IsSet() const; // Returns true iff the flag was set.
31 31
32 // For subtle reasons that may be different on different architectures,
33 // a different thread testing IsSet() may erroneously read 'true' after
34 // this method has been called.
35 void UnsafeResetForTesting();
36
32 private: 37 private:
33 base::subtle::Atomic32 flag_; 38 base::subtle::Atomic32 flag_;
34 #if !defined(NDEBUG) 39 #if !defined(NDEBUG)
35 PlatformThreadId set_on_; 40 PlatformThreadId set_on_;
36 #endif 41 #endif
37 42
38 DISALLOW_COPY_AND_ASSIGN(CancellationFlag); 43 DISALLOW_COPY_AND_ASSIGN(CancellationFlag);
39 }; 44 };
40 45
41 } // namespace base 46 } // namespace base
42 47
43 #endif // BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_ 48 #endif // BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_
OLDNEW
« no previous file with comments | « no previous file | base/synchronization/cancellation_flag.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698