|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Single-threaded Thread Pool for debugging purposes ?thread in it ? I have a highly parallel engine where many objects can be in many states ... where work carried out at each state is done with a QueueUserWorkItem. I need to debug the system to make sure it works properly in for each individual object. Instead of kicking off a WaitCallback delegate ... I'm invoking it directly (DynamicInvoke) when I'm in Single Threaded Debug mode ... but this does alter the behaviour of my code slightly (consuming more stack, functions not exiting until 9 levels of work are done, rather than each one finishing before the next starts as with multithreaded environment). So in short, does anyone know how to make the ThreadPool only have one thread in it ? Thanks if you can help, R. Have since looked at RegisterWaitForSingleObject ... this might help me ...
if I pile up all the start object requests all waiting for an AutoResetEvent and Set the event at the completion of each object ... all the subsequent QueueUserWorkItems for the first object will be done in priority to starting other objects ... yay ! (I think) R. Show quote "Richard Chandler" <richard.nospam@mapson.richardchandler.net> wrote in message news:%23HKEsRMAGHA.2560@TK2MSFTNGP12.phx.gbl... > Does anyone know whether it's possible to make the ThreadPool only have > one thread in it ? > > I have a highly parallel engine where many objects can be in many states > ... where work carried out at each state is done with a QueueUserWorkItem. > > I need to debug the system to make sure it works properly in for each > individual object. > > Instead of kicking off a WaitCallback delegate ... I'm invoking it > directly (DynamicInvoke) when I'm in Single Threaded Debug mode ... but > this does alter the behaviour of my code slightly (consuming more stack, > functions not exiting until 9 levels of work are done, rather than each > one finishing before the next starts as with multithreaded environment). > > So in short, does anyone know how to make the ThreadPool only have one > thread in it ? > > Thanks if you can help, > > R. > > |
|||||||||||||||||||||||