forked from ROMEO/obsw
this is going to be interesting
This commit is contained in:
parent
3bf0667cbb
commit
6db9b52cb4
@ -88,8 +88,6 @@ impl<T: HasTypeId + Clone + Default> OwnedDataset<T> {
|
||||
};
|
||||
self.actual_data = data;
|
||||
}
|
||||
|
||||
fn initialize(&mut self) {}
|
||||
}
|
||||
|
||||
impl<T: HasTypeId + Clone + Default> ReferencedDataset<T> {
|
||||
|
@ -6,4 +6,5 @@ pub mod osal;
|
||||
pub mod tasks;
|
||||
pub mod objectmanager;
|
||||
pub mod datasets;
|
||||
pub mod store;
|
||||
mod mutex;
|
@ -1,5 +1,8 @@
|
||||
use crate::{check_global_threading_available, osal};
|
||||
|
||||
|
||||
// TODO test dropping of droppable data within messages (no drop on sending, dropping when receiving, no dropping when forwarding in new message)
|
||||
|
||||
pub struct MessageQueue<const DEPTH: usize> {
|
||||
queue_data: [Message; DEPTH],
|
||||
queue_id: Option<*const core::ffi::c_void>,
|
||||
@ -73,12 +76,16 @@ impl MessageQueueSender {
|
||||
Self { queue_id: None }
|
||||
}
|
||||
|
||||
// TODO if error, message is dropped, is this intended or should we return the message back out?
|
||||
pub fn send(&self, message: Message) -> Result<(), ()> {
|
||||
check_global_threading_available!();
|
||||
let queue_id = match self.queue_id {
|
||||
None => return Err(()),
|
||||
Some(id) => id,
|
||||
};
|
||||
// we move ownership out to C (so must not drop it)
|
||||
// regaining ownership in receive() where it then will be dropped
|
||||
let message = core::mem::ManuallyDrop::new(message);
|
||||
let res: u8;
|
||||
unsafe {
|
||||
// safe because:
|
||||
|
Loading…
x
Reference in New Issue
Block a user