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

make mstoolkit (more) thread safe #25

Open
2 tasks
rickhelmus opened this issue Jul 12, 2024 · 1 comment
Open
2 tasks

make mstoolkit (more) thread safe #25

rickhelmus opened this issue Jul 12, 2024 · 1 comment
Assignees

Comments

@rickhelmus
Copy link
Contributor

rickhelmus commented Jul 12, 2024

Hello,

I was hoping to use mstoolkit in a multi-threaded (with a private MSReader object per thread), but ran into issues. So far, I noticed the following needs to be changed:

  • Use strtok_s() (Windows) or strtok_r() instead of strtok(), as the latter uses a static buffer and is therefore not thread safe. See e.g. https://stackoverflow.com/a/54702249
  • The lLastScanIndex variable defined in mzParser.h is static. Moving this to a member variable of RAMPFILE seems like a proper solution.

So far, I quickly patched the above changes, and things seem OK. But at the moment I am also only using just the mzML part of the library. If more issues will arise, I will update this issue again.

Thanks,
Rick

edit1: I made the issue more generic for threading after noticing more issues.

@rickhelmus rickhelmus changed the title strtok() usage make mstoolkit (more) thread safe Jul 15, 2024
@mhoopmann
Copy link
Owner

Hi Rick,
Yes, I should make MSToolkit more thread safe. I can implement changes where you suggest and look for others as well.
Cheers,
Mike

@mhoopmann mhoopmann self-assigned this Jul 15, 2024
rickhelmus added a commit to rickhelmus/mstoolkit that referenced this issue Sep 3, 2024
mhoopmann pushed a commit that referenced this issue Sep 9, 2024
Co-authored-by: Michael Hoopmann <[email protected]>
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

No branches or pull requests

2 participants