Skip to content

make mstoolkit (more) thread safe #25

@rickhelmus

Description

@rickhelmus

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions