Skip to content

Commit 3eefe76

Browse files
authored
Feature/send and sync (#48)
Make wrapper classes Send and Sync as appropriate.
1 parent fbc5169 commit 3eefe76

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

crates/openvino/src/core.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ pub struct Core {
2020
}
2121
drop_using_function!(Core, ie_core_free);
2222

23+
unsafe impl Send for Core {}
24+
2325
impl Core {
2426
/// Construct a new OpenVINO [`Core`]--this is the primary entrypoint for constructing and using
2527
/// inference networks. Because this function may load OpenVINO's shared libraries at runtime,

crates/openvino/src/network.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ pub struct CNNNetwork {
2121
}
2222
drop_using_function!(CNNNetwork, ie_network_free);
2323

24+
unsafe impl Send for CNNNetwork {}
25+
unsafe impl Sync for CNNNetwork {}
26+
2427
impl CNNNetwork {
2528
/// Retrieve the number of network inputs.
2629
pub fn get_inputs_len(&self) -> Result<usize> {
@@ -116,6 +119,8 @@ pub struct ExecutableNetwork {
116119
}
117120
drop_using_function!(ExecutableNetwork, ie_exec_network_free);
118121

122+
unsafe impl Send for ExecutableNetwork {}
123+
119124
impl ExecutableNetwork {
120125
/// Create an [`InferRequest`].
121126
pub fn create_infer_request(&mut self) -> Result<InferRequest> {

crates/openvino/src/request.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ pub struct InferRequest {
1212
}
1313
drop_using_function!(InferRequest, ie_infer_request_free);
1414

15+
unsafe impl Send for InferRequest {}
16+
unsafe impl Sync for InferRequest {}
17+
1518
impl InferRequest {
1619
/// Set the batch size of the inference requests.
1720
pub fn set_batch_size(&mut self, size: usize) -> Result<()> {

0 commit comments

Comments
 (0)