Skip to content

Commit e35182b

Browse files
committed
chore: stop thread sampler before release explicitely
1 parent 49d16a1 commit e35182b

File tree

1 file changed

+4
-0
lines changed
  • libs/darwin-kperf/criterion/src

1 file changed

+4
-0
lines changed

libs/darwin-kperf/criterion/src/pmc.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ impl HardwareCounter {
128128
impl Drop for HardwareCounter {
129129
#[expect(unsafe_code)]
130130
fn drop(&mut self) {
131+
// preempt the drop order, by calling `stop` here, instead of inside the ThreadSampler's
132+
// drop.
133+
let _result = self.thread.stop();
134+
131135
// SAFETY: the ThreadSampler field is dropped after this runs (struct
132136
// drop order is field declaration order), and we are the sole owner.
133137
// No ThreadSampler will be running after this point.

0 commit comments

Comments
 (0)