Skip to content

examples: remove call to exit from thread function#5451

Merged
hzhou merged 1 commit intopmodels:mainfrom
hzhou:2107_example
Jul 28, 2021
Merged

examples: remove call to exit from thread function#5451
hzhou merged 1 commit intopmodels:mainfrom
hzhou:2107_example

Conversation

@hzhou
Copy link
Copy Markdown
Contributor

@hzhou hzhou commented Jul 20, 2021

Pull Request Description

The exit call in the thread functions have potential thread racing
issues and may leave another process hanging. I think it is unnecessary
for the example and may cause more confusion.

Fixes #5444

[skip warnings]

Author Checklist

  • Provide Description
    Particularly focus on why, not what. Reference background, issues, test failures, xfail entries, etc.
  • Commits Follow Good Practice
    Commits are self-contained and do not do two things at once.
    Commit message is of the form: module: short description
    Commit message explains what's in the commit.
  • Passes All Tests
    Whitespace checker. Warnings test. Additional tests via comments.
  • Contribution Agreement
    For non-Argonne authors, check contribution agreement.
    If necessary, request an explicit comment from your companies PR approval manager.

@hzhou hzhou requested a review from raffenet July 20, 2021 19:57
Copy link
Copy Markdown
Contributor

@raffenet raffenet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing these is an improvement. MPI_Abort or pthread_exit would also be acceptable. As an aside, this example looks incorrect for MPI_THREAD_SERIALIZED thread level.

@hzhou
Copy link
Copy Markdown
Contributor Author

hzhou commented Jul 26, 2021

As an aside, this example looks incorrect for MPI_THREAD_SERIALIZED thread level.

Yeah. I think the mutex lock should be inside the condition of MPI_THREAD_SERIALIZED. We don't need check MPI_THREAD_SINGLE or MPI_THREAD_FUNNELED since they should've exit the thread already.

The exit call in the thread functions have potential thread racing
issues and may leave another process hanging. I think it is unnecessary
for the example and may cause more confusion.
@hzhou hzhou merged commit 31bca9d into pmodels:main Jul 28, 2021
@hzhou hzhou deleted the 2107_example branch July 28, 2021 02:30
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.

Potential error due to the released lock &mpi_lock before program eixt

2 participants