Skip to content

Commit

Permalink
Make Odb Send and Sync
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joshtriplett committed Nov 11, 2021
1 parent 1ac20e7 commit 25140d6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/odb.rs
Expand Up @@ -18,6 +18,10 @@ pub struct Odb<'repo> {
_marker: marker::PhantomData<Object<'repo>>,
}

// `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;

Expand Down

0 comments on commit 25140d6

Please sign in to comment.