dfarino

dfarino dfarino

Niner since 2006

Comments

  • CCR Programming - Jeffrey Richter and George ​Chrysanthak​opoulos

    Hi George,

    I have a comment about the UseBackgroundThreads static property on Dispatcher.

    It looks like you can set this property and its value is used during the creation of a Dispatcher instance. It feels to me like it should be a contructor parameter instead of a static property.

    The reason I ask is that we have CCR code (running in the same AppDomain) that was written by several developers. It seems like having to do something like this introduces a race condition:

    bool old = Dispatcher.UseBackgroundThreads;
    Dispatcher.UseBackgroundThreads = true;
    Dispatcher d = new Dispatcher();
    Dispatcher.UseBackgroundThreads = old;

    Am I missing the reason for this design decision?

    Thanks,
    Dan