xtd 0.2.0
Loading...
Searching...
No Matches

◆ stop()

void xtd::timers::timer::stop ( )

Stops raising the xtd::timers::timer::elapsed event by setting xtd::timers::timer::enabled to false.

Remarks
You can also stop timing by setting xtd::timers::timer::enabled to false.
Note
The signal to raise the xtd::timers::timer::elapsed event is always queued for execution on a xtd::threading::thread_pool thread, so the event-handling method might run on one thread at the same time that a call to the xtd::timers::timer::stop method runs on another thread. This might result in the xtd::timers::timer::elapsed event being raised after the xtd::timers::timer::stop method is called. The second code example in the Examples section shows one way to work around this race condition.