Skip to content

Commit 60b6fc3

Browse files
committed
Fix #33
1 parent 7cd4b01 commit 60b6fc3

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/hostfxr/context.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use std::{
2424
marker::PhantomData,
2525
mem::{self, ManuallyDrop, MaybeUninit},
2626
ptr::NonNull,
27-
rc::Rc,
27+
cell::Cell
2828
};
2929

3030
#[cfg(feature = "net8_0")]
@@ -85,9 +85,11 @@ pub struct HostfxrContext<I> {
8585
is_primary: bool,
8686
runtime_delegates: EnumMap<hostfxr_delegate_type, OnceCell<RawFunctionPtr>>,
8787
context_type: PhantomData<I>,
88-
not_thread_safe: PhantomData<Rc<HostfxrLibrary>>,
88+
not_sync: PhantomData<Cell<HostfxrLibrary>>
8989
}
9090

91+
unsafe impl<I> Send for HostfxrContext<I> {}
92+
9193
impl<I> Debug for HostfxrContext<I> {
9294
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9395
f.debug_struct("HostfxrContext")
@@ -117,7 +119,7 @@ impl<I> HostfxrContext<I> {
117119
is_primary,
118120
runtime_delegates: EnumMap::default(),
119121
context_type: PhantomData,
120-
not_thread_safe: PhantomData,
122+
not_sync: PhantomData,
121123
}
122124
}
123125

src/hostfxr/library.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ use std::{
99
env::consts::EXE_SUFFIX,
1010
ffi::OsString,
1111
path::{Path, PathBuf},
12-
rc::Rc,
12+
sync::Arc,
1313
};
1414

1515
pub(crate) type HostfxrLibrary = Container<crate::bindings::hostfxr::wrapper_option::Hostfxr>;
16-
pub(crate) type SharedHostfxrLibrary = Rc<HostfxrLibrary>;
16+
pub(crate) type SharedHostfxrLibrary = Arc<HostfxrLibrary>;
1717
#[allow(clippy::cast_possible_wrap)]
1818
pub(crate) const UNSUPPORTED_HOST_VERSION_ERROR_CODE: i32 =
1919
HostingError::HostApiUnsupportedVersion.value() as i32;

0 commit comments

Comments
 (0)