Skip to content

Commit ef51d22

Browse files
author
Colin Robertson
authored
Merge pull request MicrosoftDocs#1992 from nschonni/double-the
typo: Double word "the"
2 parents 4cb194f + 9e285d1 commit ef51d22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/cppcx/events-c-cx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The next example shows how to add custom add, remove, and raise methods to an ev
4343

4444
## Removing an event handler from the subscriber side
4545

46-
In some rare cases, you may want to remove an event handler for an event that you previously subscribed to. For example, you may want to replace it with another event handler or you may want to delete some resources that are held by it. To remove a handler, you must store the EventRegistrationToken that's returned from the `+=` operation. You can then use the `-=` operator on the token to remove an event handler. However, the original handler could still be invoked even after it's removed. For example, a race condition may arise when the the event source gets a list of handlers and starts to invoke them. If an event handler gets removed while this happens, the list becomes out of date. So, if you intend to remove an event handler, create a member flag. Set it if the event is removed, and then in the event handler, check the flag, and return immediately if it's set. The next example shows the basic pattern.
46+
In some rare cases, you may want to remove an event handler for an event that you previously subscribed to. For example, you may want to replace it with another event handler or you may want to delete some resources that are held by it. To remove a handler, you must store the EventRegistrationToken that's returned from the `+=` operation. You can then use the `-=` operator on the token to remove an event handler. However, the original handler could still be invoked even after it's removed. For example, a race condition may arise when the event source gets a list of handlers and starts to invoke them. If an event handler gets removed while this happens, the list becomes out of date. So, if you intend to remove an event handler, create a member flag. Set it if the event is removed, and then in the event handler, check the flag, and return immediately if it's set. The next example shows the basic pattern.
4747

4848
[!code-cpp[cx_events#04](../cppcx/codesnippet/CPP/eventsupportinvs/eventclientclass.h#04)]
4949

0 commit comments

Comments
 (0)