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

Signal handlers use atomics #715

Merged
merged 3 commits into from Sep 4, 2013

Conversation

Dr15Jones
Copy link
Contributor

Changed the unix signal handler used to allow an external user to tell cmsRun to stop processing. The signal handler used to use a mutex but now uses an std::atomic.
Removed some obsolete code which was related to the signal handler.

…nix signal handler

The variable my_sig_num_ was the only place where getSigNum was ever called and the value of the variable was never used after that. Both the variable and the function have been removed.
The unix signal handler code no longer uses a mutex and instead uses a std::atomic to denote if an external user has requested that the framework stop processing events.
…own request

To be properly thread safe under C++11 we switched from using a volatile bool to a volatile std::atomic<bool> as the way to communicate an external shutdown request. The mutex usr2_lock was also removed since it actually was never used correctly anyway and the std::atomic does the work the mutex should have been used for.
The function getSigNum() and its related global variables were removed since the function is no longer used anywhere.
Since the variable shutdown_flag is not being used to synchronize other variables we can use the memory_order_relaxed which requires less synchronization between CPUs.
@Dr15Jones
Copy link
Contributor Author

+1

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 4, 2013

This pull request is fully signed and it will be integrated in one of the next IBs unless changes or unless it breaks tests.

@nclopezo
Copy link
Contributor

nclopezo commented Sep 4, 2013

Hi,

I ran the tests on top of CMSSW_7_0_X_2013-09-04-0200, all tests passed:

https://cmssdt.cern.ch/jenkins/job/Pull-Request-Integration/ARCHITECTURE=slc5_amd64_gcc472/386/console

you can see the artifacts here:

https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/386

nclopezo added a commit that referenced this pull request Sep 4, 2013
@nclopezo nclopezo merged commit 1e891db into cms-sw:CMSSW_7_0_X Sep 4, 2013
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.

None yet

3 participants