Make Library Send

This commit is contained in:
Simonas Kazlauskas
2016-07-26 21:12:52 +03:00
parent e1eaf6097a
commit cf365cbdfd
2 changed files with 6 additions and 0 deletions
+2
View File
@@ -55,6 +55,8 @@ pub struct Library {
handle: *mut raw::c_void
}
unsafe impl ::std::marker::Send for Library {}
impl Library {
fn open<P>(filename: Option<P>, flags: raw::c_int) -> ::Result<Library>
where P: AsRef<OsStr> {
+4
View File
@@ -15,6 +15,10 @@ use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
/// A platform-specific equivalent of the cross-platform `Library`.
pub struct Library(winapi::HMODULE);
// Theres little documentation on Send-ability of HMODULE, but lack of warnings on the MSDN page
// and reading http://stackoverflow.com/a/11254061, it seems like it should be fine?
unsafe impl ::std::marker::Send for Library {}
impl Library {
/// Find and load a shared library (module).
///