A MIDI Library for .NET

Clock.Stop Method

Stops the clock (but does not reset its time or discard pending events).

public void Stop();

Remarks

This method stops the progression of the clock. It may only be called when the clock is running.

Any scheduled but as-yet-unsent messages remain in the queue. A consecutive call to Start can re-start the progress of the clock, or Reset can discard pending messages and reset the clock to zero.

This method waits for any in-progress messages to be processed and joins (shuts down) the scheduler thread before returning, so when it returns you can be sure that no more messages will be sent or callbacks invoked.

It is illegal to call Stop from the scheduler thread (ie, from any Message.SendNow method or CallbackMessage. If a callback really needs to stop the clock, consider using BeginInvoke to arrange for it to happen in another thread.

Exceptions

Exception Type Condition
InvalidOperationException Clock is not running or Stop was invoked from the scheduler thread.

See Also

Clock Class | Midi Namespace | Start | Reset