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

Add allowParallel flag to allow multiple readers to be created #292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nh2
Copy link
Contributor

@nh2 nh2 commented Jun 16, 2024

Handy for multithreaded work, we also use it in an extension of pye57:

davidcaron/pye57@7d2dd71

CC @chpatrick

nh2 pushed a commit to nh2/pye57 that referenced this pull request Jun 16, 2024
@asmaloney
Copy link
Owner

Thanks Niklas.

This library wasn't designed to handle anything parallel/threaded. That's probably why they put that check in there.

So I'm reticent to add a "skip this error" flag that would imply that it's supported in any way....

@chpatrick
Copy link
Contributor

chpatrick commented Jun 20, 2024 via email

@nh2
Copy link
Contributor Author

nh2 commented Jun 20, 2024

Right, in the same way as any other C++ data structure allows, e.g. std::vector. It allows parallel reading even though .push_back() is completely thread-unsafe.

The way I see it, your library provides a way to prevent parallel access (better than std::vector in this regard which has no saferails). But there should be a way to turn that off for read-only use cases.

@asmaloney
Copy link
Owner

After thinking about it a bit, this feels more like a workaround than a proper solution.

Some of the code in this library is kinda... old & gnarly. To feel more comfortable with moving in this direction, I'd like to see:

  • a test added to the test suite doing CV reads on multiple threads
  • a test using multiple threads with the "simple" API reader (probably run into this)
  • the CI fixed for the two cases that are broken so we know this works across all tested platforms

Then with the tests in place:

  • fix any other issues that come up
  • remove the readerCount() check in CompressedVectorNodeImpl completely

Then the lib would fully support multiple readers.

@nigels-com
Copy link
Contributor

Ouch. We have a backlogged ticket for testing multi-threaded reading and writing of seperate point clouds.
We may be able to contribute to this effort, at least by running it though some internal test coverage.

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.

4 participants