mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
bhm: Fix a warning in the Linux sampler (#30924)
Use curly braces instead of an explicit drop to control the end of a borrow.
This commit is contained in:
parent
7305c59304
commit
bd052f536e
1 changed files with 49 additions and 49 deletions
|
@ -207,6 +207,8 @@ impl Sampler for LinuxSampler {
|
||||||
|
|
||||||
// Safety: non-exclusive reference only
|
// Safety: non-exclusive reference only
|
||||||
// since sampled threads are accessing this concurrently
|
// since sampled threads are accessing this concurrently
|
||||||
|
let result;
|
||||||
|
{
|
||||||
let shared_state = unsafe { &*SHARED_STATE.0.get() };
|
let shared_state = unsafe { &*SHARED_STATE.0.get() };
|
||||||
shared_state
|
shared_state
|
||||||
.msg2
|
.msg2
|
||||||
|
@ -218,7 +220,7 @@ impl Sampler for LinuxSampler {
|
||||||
let context = CONTEXT.load(Ordering::SeqCst);
|
let context = CONTEXT.load(Ordering::SeqCst);
|
||||||
let mut cursor = mem::MaybeUninit::uninit();
|
let mut cursor = mem::MaybeUninit::uninit();
|
||||||
let ret = unsafe { unw_init_local(cursor.as_mut_ptr(), context) };
|
let ret = unsafe { unw_init_local(cursor.as_mut_ptr(), context) };
|
||||||
let result = if ret == UNW_ESUCCESS {
|
result = if ret == UNW_ESUCCESS {
|
||||||
let mut native_stack = NativeStack::new();
|
let mut native_stack = NativeStack::new();
|
||||||
loop {
|
loop {
|
||||||
let ip = match get_register(cursor.as_mut_ptr(), RegNum::Ip) {
|
let ip = match get_register(cursor.as_mut_ptr(), RegNum::Ip) {
|
||||||
|
@ -257,9 +259,7 @@ impl Sampler for LinuxSampler {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.wait_through_intr()
|
.wait_through_intr()
|
||||||
.expect("msg4 failed");
|
.expect("msg4 failed");
|
||||||
|
}
|
||||||
// No-op, but marks the end of the shared borrow
|
|
||||||
drop(shared_state);
|
|
||||||
|
|
||||||
clear_shared_state();
|
clear_shared_state();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue