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

Side by Side Diff: runtime/vm/os_thread.h

Issue 1748953003: - Add assertions in MutexLocker/MonitorLocker to ensure that the code enclosed (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 4 years, 9 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 | « runtime/vm/message_handler.cc ('k') | runtime/vm/os_thread_android.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_OS_THREAD_H_ 5 #ifndef VM_OS_THREAD_H_
6 #define VM_OS_THREAD_H_ 6 #define VM_OS_THREAD_H_
7 7
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 OSThread* next_; 260 OSThread* next_;
261 }; 261 };
262 262
263 263
264 class Mutex { 264 class Mutex {
265 public: 265 public:
266 Mutex(); 266 Mutex();
267 ~Mutex(); 267 ~Mutex();
268 268
269 void Lock(); 269 void Lock();
270 bool TryLock(); 270 bool TryLock(); // Returns false if lock is busy and locking failed.
271 void Unlock(); 271 void Unlock();
272 272
273 #if defined(DEBUG) 273 #if defined(DEBUG)
274 bool IsOwnedByCurrentThread() const { 274 bool IsOwnedByCurrentThread() const {
275 return owner_ == OSThread::GetCurrentThreadId(); 275 return owner_ == OSThread::GetCurrentThreadId();
276 } 276 }
277 #else 277 #else
278 bool IsOwnedByCurrentThread() const { 278 bool IsOwnedByCurrentThread() const {
279 UNREACHABLE(); 279 UNREACHABLE();
280 return false; 280 return false;
(...skipping 15 matching lines...) Expand all
296 enum WaitResult { 296 enum WaitResult {
297 kNotified, 297 kNotified,
298 kTimedOut 298 kTimedOut
299 }; 299 };
300 300
301 static const int64_t kNoTimeout = 0; 301 static const int64_t kNoTimeout = 0;
302 302
303 Monitor(); 303 Monitor();
304 ~Monitor(); 304 ~Monitor();
305 305
306 bool TryEnter(); // Returns false if lock is busy and locking failed.
306 void Enter(); 307 void Enter();
307 void Exit(); 308 void Exit();
308 309
309 // Wait for notification or timeout. 310 // Wait for notification or timeout.
310 WaitResult Wait(int64_t millis); 311 WaitResult Wait(int64_t millis);
311 WaitResult WaitMicros(int64_t micros); 312 WaitResult WaitMicros(int64_t micros);
312 313
313 // Notify waiting threads. 314 // Notify waiting threads.
314 void Notify(); 315 void Notify();
315 void NotifyAll(); 316 void NotifyAll();
(...skipping 16 matching lines...) Expand all
332 #endif // defined(DEBUG) 333 #endif // defined(DEBUG)
333 334
334 DISALLOW_COPY_AND_ASSIGN(Monitor); 335 DISALLOW_COPY_AND_ASSIGN(Monitor);
335 }; 336 };
336 337
337 338
338 } // namespace dart 339 } // namespace dart
339 340
340 341
341 #endif // VM_OS_THREAD_H_ 342 #endif // VM_OS_THREAD_H_
OLDNEW
« no previous file with comments | « runtime/vm/message_handler.cc ('k') | runtime/vm/os_thread_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698