views:

296

answers:

1

What is a common real life use for Dispatcher.DisableProcessing in WPF? Can I use it to suspend rendering and layout when I build a complex UI in code?

+2  A: 

As per MSDN:

Disabling dispatcher processing is an advanced method that is intended to eliminate the chance of unrelated reentrancy.

So you're doing some work on the same thread the Dispatcher is executing on, but you don't want it processing events whilst you do that work. I think the really pertinent point is:

The effects of disabling processing are as follows:

* CLR locks will not pump messages internally.

If I understand this correctly, it means that you can safely lock and not have the dispatcher pump events as a result (which might cause undesired reentrancy).

HTH, Kent

Kent Boogaart
Maybe that is just a language problem but what is a reentrancy?
bitbonk