rust-bindings: Sysroot is Send

I want to spawn tokio worker threads referencing sysroot objects
in bootc.

Just like the repo, there's nothing thread-local about it.
This commit is contained in:
Colin Walters 2023-03-04 10:54:48 -05:00
parent be0dbf02d7
commit b00f27d476
4 changed files with 7 additions and 4 deletions

View File

@ -217,6 +217,7 @@ status = "generate"
[[object]] [[object]]
name = "OSTree.Sysroot" name = "OSTree.Sysroot"
status = "generate" status = "generate"
concurrency = "send"
[[object.function]] [[object.function]]
name = "deploy_tree_with_options" name = "deploy_tree_with_options"
[[object.function.parameter]] [[object.function.parameter]]

View File

@ -543,8 +543,8 @@ impl Sysroot {
#[cfg(any(feature = "v2017_10", feature = "dox"))] #[cfg(any(feature = "v2017_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))]
#[doc(alias = "journal-msg")] #[doc(alias = "journal-msg")]
pub fn connect_journal_msg<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_journal_msg<F: Fn(&Self, &str) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn journal_msg_trampoline<F: Fn(&Sysroot, &str) + 'static>(this: *mut ffi::OstreeSysroot, msg: *mut libc::c_char, f: glib::ffi::gpointer) { unsafe extern "C" fn journal_msg_trampoline<F: Fn(&Sysroot, &str) + Send + 'static>(this: *mut ffi::OstreeSysroot, msg: *mut libc::c_char, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&from_glib_borrow(this), &glib::GString::from_glib_borrow(msg)) f(&from_glib_borrow(this), &glib::GString::from_glib_borrow(msg))
} }
@ -556,6 +556,8 @@ impl Sysroot {
} }
} }
unsafe impl Send for Sysroot {}
impl fmt::Display for Sysroot { impl fmt::Display for Sysroot {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("Sysroot") f.write_str("Sysroot")

View File

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 0eeebbdf9d4d) Generated by gir (https://github.com/gtk-rs/gir @ 0eeebbdf9d4d)
from gir-files (@ a43b14381142) from gir-files (@ be0dbf02d770)

View File

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 0eeebbdf9d4d) Generated by gir (https://github.com/gtk-rs/gir @ 0eeebbdf9d4d)
from gir-files (@ a43b14381142) from gir-files (@ be0dbf02d770)