repo: Add concurrency=send
Ultimately a repo is just a file descriptor wrapper with some cached data, etc. We can send it between threads, much like how `gio::File` is `Send`. Motivated by trying to write to a repo from a separate thread in https://github.com/cgwalters/ostree-container
This commit is contained in:
parent
0718f433a2
commit
b5496f70f6
|
|
@ -139,6 +139,7 @@ status = "generate"
|
|||
[[object]]
|
||||
name = "OSTree.Repo"
|
||||
status = "generate"
|
||||
concurrency = "send"
|
||||
[[object.function]]
|
||||
# [MANUAL] we special-case the checksum value
|
||||
pattern = "^(write_content|write_content_async|write_metadata|write_metadata_async)$"
|
||||
|
|
|
|||
|
|
@ -1060,8 +1060,8 @@ impl Repo {
|
|||
// unsafe { TODO: call ostree_sys:ostree_repo_traverse_parents_get_commits() }
|
||||
//}
|
||||
|
||||
pub fn connect_gpg_verify_result<F: Fn(&Repo, &str, &GpgVerifyResult) + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn gpg_verify_result_trampoline<F: Fn(&Repo, &str, &GpgVerifyResult) + 'static>(this: *mut ostree_sys::OstreeRepo, checksum: *mut libc::c_char, result: *mut ostree_sys::OstreeGpgVerifyResult, f: glib_sys::gpointer) {
|
||||
pub fn connect_gpg_verify_result<F: Fn(&Repo, &str, &GpgVerifyResult) + Send + 'static>(&self, f: F) -> SignalHandlerId {
|
||||
unsafe extern "C" fn gpg_verify_result_trampoline<F: Fn(&Repo, &str, &GpgVerifyResult) + Send + 'static>(this: *mut ostree_sys::OstreeRepo, checksum: *mut libc::c_char, result: *mut ostree_sys::OstreeGpgVerifyResult, f: glib_sys::gpointer) {
|
||||
let f: &F = &*(f as *const F);
|
||||
f(&from_glib_borrow(this), &GString::from_glib_borrow(checksum), &from_glib_borrow(result))
|
||||
}
|
||||
|
|
@ -1073,6 +1073,8 @@ impl Repo {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for Repo {}
|
||||
|
||||
impl fmt::Display for Repo {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Repo")
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
Generated by gir (https://github.com/gtk-rs/gir @ 2d1ffab)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ b3c601f)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ 9fe8b26)
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
Generated by gir (https://github.com/gtk-rs/gir @ 2d1ffab)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ b3c601f)
|
||||
from gir-files (https://github.com/gtk-rs/gir-files @ 9fe8b26)
|
||||
|
|
|
|||
Loading…
Reference in New Issue