From e192e09b0e568223ad68e88aaf35e3ca63724f37 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Thu, 11 Nov 2021 00:51:15 +0100 Subject: [PATCH] Make `Odb` `Send` and `Sync` As of libgit2 1.2.0, `git_odb` uses locking internally, and should be thread-safe. Mark it `Send` and `Sync` to allow access from multiple threads. --- src/odb.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/odb.rs b/src/odb.rs index 99392e052d..ba3a4c6286 100644 --- a/src/odb.rs +++ b/src/odb.rs @@ -18,6 +18,10 @@ pub struct Odb<'repo> { _marker: marker::PhantomData>, } +// `git_odb` uses locking and atomics internally. +unsafe impl<'repo> Send for Odb<'repo>; +unsafe impl<'repo> Sync for Odb<'repo>; + impl<'repo> Binding for Odb<'repo> { type Raw = *mut raw::git_odb;