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

Unified Diff: runtime/vm/os_thread.h

Issue 1758503002: Make the lock/unlock and Enter/Exit methods in Mutex and Monitor private so taht we always use the … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: self-code-review-comments Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/message_handler_test.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_thread.h
diff --git a/runtime/vm/os_thread.h b/runtime/vm/os_thread.h
index 2ca6a7c8f4743912aa9790b8828506e8e6199bdc..976a137148770033b9a5ca9b8c92c89fcd774e40 100644
--- a/runtime/vm/os_thread.h
+++ b/runtime/vm/os_thread.h
@@ -266,10 +266,6 @@ class Mutex {
Mutex();
~Mutex();
- void Lock();
- bool TryLock(); // Returns false if lock is busy and locking failed.
- void Unlock();
-
#if defined(DEBUG)
bool IsOwnedByCurrentThread() const {
return owner_ == OSThread::GetCurrentThreadId();
@@ -282,11 +278,22 @@ class Mutex {
#endif
private:
+ void Lock();
+ bool TryLock(); // Returns false if lock is busy and locking failed.
+ void Unlock();
+
MutexData data_;
#if defined(DEBUG)
ThreadId owner_;
#endif // defined(DEBUG)
+ friend class MutexLocker;
+ friend class SafepointMutexLocker;
+ friend class OSThreadIterator;
+ friend class TimelineEventBlockIterator;
+ friend class TimelineEventRecorder;
+ friend class PageSpace;
+ friend void Dart_TestMutex();
DISALLOW_COPY_AND_ASSIGN(Mutex);
};
@@ -303,18 +310,6 @@ class Monitor {
Monitor();
~Monitor();
- bool TryEnter(); // Returns false if lock is busy and locking failed.
- void Enter();
- void Exit();
-
- // Wait for notification or timeout.
- WaitResult Wait(int64_t millis);
- WaitResult WaitMicros(int64_t micros);
-
- // Notify waiting threads.
- void Notify();
- void NotifyAll();
-
#if defined(DEBUG)
bool IsOwnedByCurrentThread() const {
return owner_ == OSThread::GetCurrentThreadId();
@@ -327,11 +322,26 @@ class Monitor {
#endif
private:
+ bool TryEnter(); // Returns false if lock is busy and locking failed.
+ void Enter();
+ void Exit();
+
+ // Wait for notification or timeout.
+ WaitResult Wait(int64_t millis);
+ WaitResult WaitMicros(int64_t micros);
+
+ // Notify waiting threads.
+ void Notify();
+ void NotifyAll();
+
MonitorData data_; // OS-specific data.
#if defined(DEBUG)
ThreadId owner_;
#endif // defined(DEBUG)
+ friend class MonitorLocker;
+ friend class SafepointMonitorLocker;
+ friend void Dart_TestMonitor();
DISALLOW_COPY_AND_ASSIGN(Monitor);
};
« no previous file with comments | « runtime/vm/message_handler_test.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698