use crate::{Context, Result, Stream};
#[derive(Debug)]
pub struct Event {
native: mircuda_sys::Event,
}
impl Context {
pub fn create_event(&self, timing: bool) -> Result<Event> {
Ok(Event {
native: self.native.create_event(timing)?,
})
}
}
impl Event {
pub fn record(&self, stream: &Stream) -> Result<()> {
Ok(self.native.record(&stream.native)?)
}
pub fn synchronize(&self) -> Result<()> {
Ok(self.native.synchronize()?)
}
pub fn elapsed_ms(&self, end: &Self) -> Result<f32> {
Ok(self.native.elapsed_ms(&end.native)?)
}
}
impl Stream {
pub fn wait(&self, event: &Event) -> Result<()> {
Ok(self.native.wait(&event.native)?)
}
}