(&self)
| 1601 | } |
| 1602 | |
| 1603 | fn detach_current_thread(&self) { |
| 1604 | unsafe { |
| 1605 | // Get the number of the already created VMs. This is most probably 1, but we retrieve the number just in case... |
| 1606 | let mut created_vms_size: jsize = 0; |
| 1607 | tweaks::get_created_java_vms( |
| 1608 | &mut Vec::with_capacity(created_vms_size as usize), |
| 1609 | 0, |
| 1610 | &mut created_vms_size, |
| 1611 | ); |
| 1612 | |
| 1613 | if created_vms_size > 0 { |
| 1614 | // Get the created VM |
| 1615 | let mut buffer: Vec<*mut JavaVM> = Vec::with_capacity(created_vms_size as usize); |
| 1616 | for _ in 0..created_vms_size { |
| 1617 | buffer.push(ptr::null_mut()); |
| 1618 | } |
| 1619 | |
| 1620 | let retjint = tweaks::get_created_java_vms( |
| 1621 | &mut buffer, |
| 1622 | created_vms_size, |
| 1623 | &mut created_vms_size, |
| 1624 | ); |
| 1625 | if retjint == JNI_OK { |
| 1626 | let dct = (**buffer[0]).v1_4.DetachCurrentThread; |
| 1627 | (dct)(buffer[0]); |
| 1628 | } else { |
| 1629 | warn(&format!( |
| 1630 | "Error while retrieving the created JVMs: {}", |
| 1631 | retjint |
| 1632 | )); |
| 1633 | } |
| 1634 | } |
| 1635 | } |
| 1636 | } |
| 1637 | |
| 1638 | /// Returns the first `Instance` that is available from the passed `InstanceReceiver`s, |
| 1639 | /// along with the index of the receiver that was selected and actually returned the instance. |
no test coverage detected