libelektra icon indicating copy to clipboard operation
libelektra copied to clipboard

Internal Refactoring for better thread safety

Open markus2330 opened this issue 2 years ago • 3 comments
trafficstars

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:

  • [ ] #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).
  • [x] #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.
  • [x] #4869 search for all global variables. If there are any, please report and let us discuss if automatic refactoring makes sense.

markus2330 avatar Mar 05 '23 07:03 markus2330

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 avatar Mar 05 '23 15:03 kodebach

Moved to https://github.com/ElektraInitiative/libelektra/issues/4870#issue-1620377910

kodebach avatar Mar 11 '23 18:03 kodebach

Moved to https://github.com/ElektraInitiative/libelektra/issues/4869#issuecomment-1465208310

kodebach avatar Mar 11 '23 19:03 kodebach

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 :sparkling_heart:

github-actions[bot] avatar Mar 26 '24 01:03 github-actions[bot]

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 :sparkling_heart:

github-actions[bot] avatar Apr 09 '24 01:04 github-actions[bot]