{{ message }}
Thread namespacing#3830
Merged
Merged
Conversation
a94fc26 to
5c6c053
Compare
Member
There was a problem hiding this comment.
I was going to suggest we rename this, but I think it's wholly unused so perhaps we should just remove it.
Member
|
Thanks for taking care of this. I made a couple of quite trivial comments, but this is great. 😀 |
The function pthread_num_processors_np is currently unused and superseded by the function `git_online_cpus`. Remove the function.
The old pthread-file did re-implement the pthreads API with exact symbol matching. As the thread-abstraction has now been split up between Unix- and Windows-specific files within the `git_` namespace to avoid symbol-clashes between libgit2 and pthreads, the rewritten wrappers have nothing to do with pthreads anymore. Rename the Windows-specific pthread-files to honor this change.
5c6c053 to
aab266c
Compare
Member
Author
|
New version fixes comments by @ethomson. Thanks for your reviews |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR aims to fix the namespacing-issue in issue #3825. The Windows-specific pthreads.c source file tries to re-implement the API exposed by pthreads by implementing many of the pthread-symbols with Windows-specific threading code. This unfortunately results in runtime errors when a user links his application to both libgit2 and winpthreads, causing one of both libraries to override symbols of the other library, causing inconsistencies.
Fix the issue by introducing proper namespacing to our threading API. Instead of trying to re-implement all functions, implement functions inside the
git_namespace and adjust the#defines in Unix-specific code.This solves the part where linking against both libraries causes runtime errors. What is still missing is to allow Windows-users to link libgit2 not against the internal thread API but against winpthread provided by MinGW/MSYS2. This will follow later either by updating this PR or creating a new one if this one got merged already.