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

Rework locking in config update #8336

Closed
julianbrost opened this issue Oct 13, 2020 · 2 comments · Fixed by #8488
Closed

Rework locking in config update #8336

julianbrost opened this issue Oct 13, 2020 · 2 comments · Fixed by #8488
Assignees
Labels
area/distributed Distributed monitoring (master, satellites, clients) enhancement New feature or request
Milestone

Comments

@julianbrost
Copy link
Contributor

Pull request #8308 introduced a spin lock to work around the fact that both Boost and STL mutexes require to unlock from the same thread that acquired the lock. There should be a better way to do this. This issue is created to not forget about this and discuss alternative solutions to solve this properly.

@julianbrost julianbrost added enhancement New feature or request area/distributed Distributed monitoring (master, satellites, clients) labels Oct 13, 2020
@julianbrost julianbrost self-assigned this Oct 13, 2020
@julianbrost
Copy link
Contributor Author

The current control flow is as follows: a new thread is started which acquires the mutex and spawns a process with a callback to be run when the process terminates. This callback then unlocks the mutex when it's done. To be able to use std::mutex, this unlock operation has to be moved to the thread that acquired the mutex. I see two relatively easy to implement options:

  1. Extent icinga::Process with a method ProcessResult& WaitForResult() that blocks until the process exited and then returns the result. Use this method instead of the callback mechanism.
  2. If the general idea for icinga::Process should be to provide an asynchronous interface, one could also implement basically the same within the callback, i.e. create a condition variable that is updated in the callback and then wait for it in the process that acquired the mutex.

@icinga-probot
Copy link
Contributor

icinga-probot bot commented Nov 27, 2020

Closed this issue because #8510 has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/distributed Distributed monitoring (master, satellites, clients) enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant