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

Internal Refactoring for better thread safety #4861

Closed
2 of 3 tasks
markus2330 opened this issue Mar 5, 2023 · 5 comments
Closed
2 of 3 tasks

Internal Refactoring for better thread safety #4861

markus2330 opened this issue Mar 5, 2023 · 5 comments
Assignees
Labels

Comments

@markus2330
Copy link
Contributor

markus2330 commented Mar 5, 2023

As the API discussions are still ongoing and an agreement on the full API will probably take some time (I still suggest to pick smaller changes which have a clear problem), I suggest that you start with internal refactoring to get the development of the refactoring tool going so that we see what it actually can do.

Following points came to my mind:

  • Replace non-thread-safe functions #4870
    usage of thread safe functions everywhere, especially strerror_r. Systematically search for all occurrences of POSIX functions that have a _r version (can be found out with apropos).
  • toml should be reentrant #4466
    Imho this is the most important problem, which leads to easily reproducible crashes if two threads do something with KDB. I am not sure, however, if and how automatic refactoring can be helpful there.
  • Remove global variables #4869
    search for all global variables. If there are any, please report and let us discuss if automatic refactoring makes sense.
@kodebach
Copy link
Member

kodebach commented Mar 5, 2023

usage of thread safe functions everywhere

Yes, that seems like a pretty good showcase example.

Imho the most important problem is

If you're using TOML and see it as an important problem, why not create a PR yourself? The issue already suggests what needs to be done and it shouldn't be too hard to do.

In any case, even if this could be automated, I think doing it by hand is much quicker and easier.

search for all global variables

Finding global variables should work with plain tree-sitter, no need for the tool I'm working on. Refactoring probably can't be automated here either, since what should be done very much depends on what the variable is used for. The only thing that might be automatable would be adding thread_local, but that might not work for all cases and also needs C11 (which I'm not sure if we want to require).

@kodebach
Copy link
Member

kodebach commented Mar 11, 2023

Moved to #4870 (comment)

@kodebach
Copy link
Member

kodebach commented Mar 11, 2023

Moved to #4869 (comment)

Copy link

I mark this stale as it did not have any activity for one year. I'll close it in two weeks if no further activity occurs. If you want it to be alive again, ping by writing a message here or create a new issue with the remainder of this issue.
Thank you for your contributions 💖

@github-actions github-actions bot added the stale label Mar 26, 2024
Copy link

github-actions bot commented Apr 9, 2024

I closed this now because it has been inactive for more than one year. If I closed it by mistake, please do not hesitate to reopen it or create a new issue with the remainder of this issue.
Thank you for your contributions 💖

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants