diff options
Diffstat (limited to 'runtime/runtime_callbacks.h')
| -rw-r--r-- | runtime/runtime_callbacks.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/runtime/runtime_callbacks.h b/runtime/runtime_callbacks.h index 9f0410d102..4cce15ed52 100644 --- a/runtime/runtime_callbacks.h +++ b/runtime/runtime_callbacks.h @@ -115,6 +115,19 @@ class MonitorCallback { virtual ~MonitorCallback() {} }; +class ParkCallback { + public: + // Called on entry to the Unsafe.#park method + virtual void ThreadParkStart(bool is_absolute, int64_t millis_timeout) + REQUIRES_SHARED(Locks::mutator_lock_) = 0; + + // Called just after the thread has woken up from going to sleep for a park(). This will only be + // called for Unsafe.park() calls where the thread did (or at least could have) gone to sleep. + virtual void ThreadParkFinished(bool timed_out) REQUIRES_SHARED(Locks::mutator_lock_) = 0; + + virtual ~ParkCallback() {} +}; + // A callback to let parts of the runtime note that they are currently relying on a particular // method remaining in it's current state. Users should not rely on always being called. If multiple // callbacks are added the runtime will short-circuit when the first one returns 'true'. @@ -193,6 +206,11 @@ class RuntimeCallbacks { void AddMonitorCallback(MonitorCallback* cb) REQUIRES_SHARED(Locks::mutator_lock_); void RemoveMonitorCallback(MonitorCallback* cb) REQUIRES_SHARED(Locks::mutator_lock_); + void ThreadParkStart(bool is_absolute, int64_t timeout) REQUIRES_SHARED(Locks::mutator_lock_); + void ThreadParkFinished(bool timed_out) REQUIRES_SHARED(Locks::mutator_lock_); + void AddParkCallback(ParkCallback* cb) REQUIRES_SHARED(Locks::mutator_lock_); + void RemoveParkCallback(ParkCallback* cb) REQUIRES_SHARED(Locks::mutator_lock_); + // Returns true if some MethodInspectionCallback indicates the method is being inspected/depended // on by some code. bool IsMethodBeingInspected(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); @@ -243,6 +261,8 @@ class RuntimeCallbacks { GUARDED_BY(Locks::mutator_lock_); std::vector<MonitorCallback*> monitor_callbacks_ GUARDED_BY(Locks::mutator_lock_); + std::vector<ParkCallback*> park_callbacks_ + GUARDED_BY(Locks::mutator_lock_); std::vector<MethodInspectionCallback*> method_inspection_callbacks_ GUARDED_BY(Locks::mutator_lock_); std::vector<DdmCallback*> ddm_callbacks_ |