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

Improve thread-safety #50

Merged

Conversation

adomasbaliuka
Copy link
Contributor

@adomasbaliuka adomasbaliuka commented Aug 11, 2024

The library uses a lot of non-const static variables, which break thread-safety. Several comments are in the code that forsee making those static variables _Thread_local to allow using this library with threads.

The changes in this PR make all non-const static variables (except those behind the pre-processor definition NOMORE_FOR_THREADS) _Thread_local.

This PR is just in case you don't want a patch but want to see the changes in a commit. According to the issue, contributions should be patch files? Here is the patch against origin/master
diff_origin_master.txt

fixes issue #46

Except where the declarations are disabled anyway with the pre-processor definition NOMORE_FOR_THREADS (which I don't know what it means).
@ViralBShah
Copy link
Contributor

cc @devmotion @nalimilan @dmbates. I hope this is good. I have tagged v0.5.0 of this package, but wanted another pair of eyes before I kick off the BB etc.

@dmbates
Copy link

dmbates commented Aug 13, 2024

Looks fine to me but I am not that knowledgeable about multi-threaded C code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants