Skip to content

Commit 49fea30

Browse files
chore: remove the drop-specific code, since Rust automatically drops the events and buffers when they go out of scope.
1 parent 5b6d246 commit 49fea30

File tree

1 file changed

+2
-18
lines changed
  • samples/introduction/async_api/src

1 file changed

+2
-18
lines changed

samples/introduction/async_api/src/main.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,24 +113,8 @@ fn main() -> Result<(), cust::error::CudaError> {
113113
// Stream is synchronized as a safety measure
114114
stream.synchronize().expect("Stream couldn't synchronize!");
115115

116-
// Events and buffers can be safely dropped now
117-
match Event::drop(start_event) {
118-
Ok(()) => println!("Successfully destroyed start_event"),
119-
Err((cuda_error, _event)) => {
120-
println!("Failed to destroy start_event: {:?}", cuda_error);
121-
}
122-
}
123-
124-
match Event::drop(stop_event) {
125-
Ok(()) => println!("Successfully destroyed stop_event"),
126-
Err((cuda_error, _event)) => {
127-
println!("Failed to destroy stop_event: {:?}", cuda_error);
128-
}
129-
}
130-
131-
DeviceBuffer::drop(device_a).expect("Couldn't drop device array!");
132-
LockedBuffer::drop(host_a).expect("Couldn't drop host array!");
133-
134116
println!("test PASSED");
135117
Ok(())
118+
119+
// The events and the memory buffers are automatically dropped here.
136120
}

0 commit comments

Comments
 (0)