From 2dc6ba27b5bbb4b5aca064d007b8305636422c5d Mon Sep 17 00:00:00 2001 From: joboet Date: Wed, 18 Oct 2023 16:21:21 +0200 Subject: [PATCH] std: send free message when xous thread parker is dropped --- library/std/src/sys/xous/thread_parking.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/library/std/src/sys/xous/thread_parking.rs b/library/std/src/sys/xous/thread_parking.rs index 3e77ecf0c73..aa39c6d2718 100644 --- a/library/std/src/sys/xous/thread_parking.rs +++ b/library/std/src/sys/xous/thread_parking.rs @@ -1,4 +1,4 @@ -use crate::os::xous::ffi::blocking_scalar; +use crate::os::xous::ffi::{blocking_scalar, scalar}; use crate::os::xous::services::{ticktimer_server, TicktimerScalar}; use crate::pin::Pin; use crate::ptr; @@ -86,3 +86,9 @@ impl Parker { } } } + +impl Drop for Parker { + fn drop(&mut self) { + scalar(ticktimer_server(), TicktimerScalar::FreeCondition(self.index()).into()).ok(); + } +}