mirror of https://github.com/sipwise/sems.git
Add a central mutex and condition variable to AmThread, which can be used by subclasses in their ::run() to determine whether they should sleep, run, or shut down. This will replace identical mechanism in subclasses that have this implemented on their own. Subclasses which don't need this are not affected. Add `_state` to the list of members protected by this mutex, obsoleting the need for atomic ops. Refactor `_joined` as an enum state, also protected by run_mutex, replacing the separate mutex. Use run_cond as signal to wake up thread waiting on the join to the complete. Notify this cond on shutdown, after setting the state to "stopping." Add ::stop_requested_unlocked() for threads which use `run_mut`. Change-Id: I0b640b54c9f601e86cbb25413cacb67e31fbe913mr13.5
parent
1b33d022e7
commit
1f709bbf99
Loading…
Reference in new issue