[#BloombergLP-bdlmt-TimerEventScheduler-cancelEvent-03]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlmt.adoc[bdlmt]::xref:BloombergLP/bdlmt/TimerEventScheduler.adoc[TimerEventScheduler]::cancelEvent
:relfileprefix: ../../../
:mrdocs:

Cancel the event identified by the specified handle&period;

== Synopsis

Declared in `&lt;bdlmt&lowbar;timereventscheduler&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
cancelEvent(
    xref:BloombergLP/bdlmt/TimerEventScheduler/Handle.adoc[Handle] handle,
    bool wait = false);
----

== Description

Cancel the event having the specified `handle`&period; Optionally use the specified `key` to uniquely identify the event&period; If the optionally specified `wait` is true, then ensure that the dispatcher thread has resumed execution before returning&period; Return 0 on successful cancellation, and a non&hyphen;zero value if the `handle` is invalid _or_ if it is too late to cancel the event&period; If this method is being invoked from the dispatcher thread then the `wait` is ignored to avoid deadlock&period;

== Return Value

0 on successful cancellation, and a non&hyphen;zero value otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *handle*
| identifier of the event to cancel
| *wait*
| if true, wait until the dispatcher has resumed
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
