Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 1.19 KB

ensuring-a-thread-safe-notification.md

File metadata and controls

20 lines (14 loc) · 1.19 KB
title manager ms.date ms.audience ms.localizationpriority api_type ms.assetid
Ensuring a Thread-Safe Notification
lindalu
11/16/2014
Developer
medium
COM
d46ce99a-4d7f-45b0-ba21-154498c15775

Ensuring a Thread-Safe Notification

Applies to: Outlook 2013 | Outlook 2016

If your client runs on a multithreaded platform, you may need assurance that calls to your IMAPIAdviseSink::OnNotify methods occur on a particular thread. Because calls to OnNotify can typically occur on any thread, it is possible to receive notifications on unexpected and unwanted threads, leading to errors that are difficult to debug.

To guarantee that calls to OnNotify for a particular notification are made on the same thread that was used for the Advise call, call HrThisThreadAdviseSink before calling Advise. HrThisThreadAdviseSink creates a new advise sink object from your advise sink object. Pass this new object in the call to Advise. All clients with advise sink objects that might not work outside the context of a particular thread should always register advise sink objects created with HrThisThreadAdviseSink.