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 pcl::MovingLeastSquares thread-safe #2418

Merged
merged 1 commit into from
Sep 7, 2018

Conversation

ThorstenHarter
Copy link
Contributor

Problem:
Running pcl::MovingLeastSquares with multiple threads may lead to an out-of-bounds exception in pcl::MLSResult::computeMLSSurface because the member MLSResult::num_neighbors is overwritten by another thread.
I'm afraid I have introduced this bug myself on refactoring the function for #2324 when I left the local variable mls_result_index at the top of the function (like in the non-OpenMP version) instead of moving it inside the parallel region (like in the OpenMP version).

Proposed solution:
Move the local variable mls_result_index inside the OpenMP parallel region, so that each thread has its private copy.

Move the local variable mls_result_index inside the #pragma omp parallel section.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants