Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is SynchronizationContext.IsWaitNotificationRequired for?

SynchronizationContext has a property called IsWaitNotificationRequired. Of its purpose, the docs have this to say:

Determines if wait notification is required.

true if wait notification is required; otherwise, false.

Gosh, that clarifies things.

What exactly is this "wait notification", and when / why would it be required / not required? Is IsWaitNotificationRequired something along the lines of Control.InvokeRequired, or is this something different?

like image 855
Joe White Avatar asked Dec 19 '11 22:12

Joe White


1 Answers

This is for infrastructure that allows hooking up into CLR synchronisation wait routine. This blog post explains how this works: https://web.archive.org/web/20080503180352/http://www.bluebytesoftware.com/blog/2008/02/27/HookingCLRBlockingCallsWithSynchronizationContext.aspx

This property will always return false if this behaviour has not been specifically overridden in a subclass of SynchronizationContext and if it does your overridden implementation of the Wait method gets called.

like image 85
Andrew Savinykh Avatar answered Oct 08 '22 17:10

Andrew Savinykh