jvmti_rs/wrapper/facade/
thread.rs1use std::ffi::c_void;
2
3use crate::{sys::*, objects::*, errors::*, JThreadInfo, JvmtiThreadState, JvmtiError, JvmtiThreadPriority, JVMTIFacadeEnv};
4
5impl<'a> JVMTIFacadeEnv<'a> {
6 pub fn get_thread_state(&self, thread: &JThreadID) -> Result<JvmtiThreadState> {
7 self.jvmti_rust().get_thread_state(thread)
8 }
9
10 pub fn get_current_thread(&self) -> Result<Option<JThreadID>> {
11 self.jvmti_rust().get_current_thread()
12 }
13
14 pub fn get_all_threads(&self) -> Result<Vec<JThreadID>> {
15 self.jvmti_rust().get_all_threads()
16 }
17
18 pub fn suspend_thread(&self, thread: &JThreadID) -> Result<()> {
19 self.jvmti_rust().suspend_thread(thread)
20 }
21
22 pub fn resume_thread(&self, thread: &JThreadID) -> Result<()> {
23 self.jvmti_rust().resume_thread(thread)
24 }
25
26 pub fn stop_thread(&self, thread: &JThreadID, exception: &JThrowable) -> Result<()> {
27 self.jvmti_rust().stop_thread(thread, exception)
28 }
29
30 pub fn interrupt_thread(&self, thread: &JThreadID) -> Result<()> {
31 self.jvmti_rust().interrupt_thread(thread)
32 }
33
34 pub fn suspend_thread_list(&self, threads: &Vec<JThreadID>) -> Result<JvmtiError> {
35 self.jvmti_rust().suspend_thread_list(threads)
36 }
37
38 pub fn resume_thread_list(&self, threads: &Vec<JThreadID>) -> Result<JvmtiError> {
39 self.jvmti_rust().resume_thread_list(threads)
40 }
41
42 pub fn get_thread_info(&self, thread: &JThreadID) -> Result<JThreadInfo> {
43 self.jvmti_rust().get_thread_info(thread)
44 }
45
46 pub fn get_owned_monitor_info(&self, thread: &JThreadID) -> Result<Vec<JObject>> {
47 self.jvmti_rust().get_owned_monitor_info(thread)
48 }
49
50 pub fn get_owned_monitor_stack_depth_info(&self, thread: &JThreadID) -> Result<Vec<JMonitorStackDepthInfo>> {
51 self.jvmti_rust().get_owned_monitor_stack_depth_info(thread)
52 }
53
54 pub fn get_current_contended_monitor(&self, thread: &JThreadID) -> Result<Option<JObject>> {
55 self.jvmti_rust().get_current_contended_monitor(thread)
56 }
57
58 pub fn run_agent_thread(&self, thread: &JThreadID,
59 proc: jvmtiStartFunction,
60 arg: *const c_void,
61 priority: JvmtiThreadPriority,
62 ) -> Result<()> {
63 self.jvmti_rust().run_agent_thread(thread, proc, arg, priority)
64 }
65
66 pub fn get_thread_local_storage(&self, thread: &JThreadID) -> Result<JLocalStorage> {
67 self.jvmti_rust().get_thread_local_storage(thread)
68 }
69
70 pub fn set_thread_local_storage(&self, thread: &JThreadID, data: &JLocalStorage) -> Result<()> {
71 self.jvmti_rust().set_thread_local_storage(thread, data)
72 }
73}