Since they look like member functions, you can add an event member variable (either ManualResetEvent or AutoResetEvent ). Then, in the Stop() method, you set an event for signaling. Between the calls Stop (Stop)) and Start () you are waiting for an event.
private AutoResetEvent _stopped = new AutoResetEvent(false); public void SomeFunction() { Stop(); _stopped.WaitOne(); Start(); }
In the stop function you would do
private void Stop() { try {
If using ManualResetEvent -
private ManualResetEvent _stopped = new ManualResetEvent(false); public void SomeFunction() { Stop(); _stopped.WaitOne(); Start(); } private void Stop() { try {
source share