Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark OdbReader and OdbWriter Send #765

Merged
merged 1 commit into from Nov 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/odb.rs
Expand Up @@ -326,6 +326,10 @@ pub struct OdbReader<'repo> {
_marker: marker::PhantomData<Object<'repo>>,
}

// `git_odb_stream` is not thread-safe internally, so it can't use `Sync`, but moving it to another
// thread and continuing to read will work.
unsafe impl<'repo> Send for OdbReader<'repo> {}

impl<'repo> Binding for OdbReader<'repo> {
type Raw = *mut raw::git_odb_stream;

Expand Down Expand Up @@ -367,6 +371,10 @@ pub struct OdbWriter<'repo> {
_marker: marker::PhantomData<Object<'repo>>,
}

// `git_odb_stream` is not thread-safe internally, so it can't use `Sync`, but moving it to another
// thread and continuing to write will work.
unsafe impl<'repo> Send for OdbWriter<'repo> {}

impl<'repo> OdbWriter<'repo> {
/// Finish writing to an ODB stream
///
Expand Down