   Using the IDirectPlay8ThreadPool interface
  Hi all,I''m avoiding concurrency problems in my program using IDirectPlay8ThreadPool interface.However, one computer might both run an IDirectPlay8Server and an IDirectPlay8Client (in other words: Both hosting and running the game). Both my client and my server class does something like...//set up IDirectPlay8ThreadPoolIDirectPlay8ThreadPool::Initialize//set up client or serverIDirectPlay8Server/Client::InitializeAnd both classes have a ::DoWork() method that processes the network.My question is: If I have successfully created the IDirectPlay8ThreadPool using CoCreateInstance(), but failed initialization with error DPNERR_ALREADYINITIALIZED because the server already has set up the thread pool, will I be able to call IDirectPlay8ThreadPool::DoWork() on the interface that failed initialization?In other words: Is it possible to run a IDirectPlay8Server and IDirectPlay8Client in the same process and set thread count to 0 for both of them and call ::DoWork() for both of them?Thanks for any help you can provideBest regardsBjørn Toft Madsen 
  DP8 uses the same thread pool for all DP objects within the same application; this is documented. Each process can thus have its own thread pool managed independently. That''s what''s not too clear in the docs.> but failed initialization with error DPNERR_ALREADYINITIALIZEDYou need to create and initialize the thread pool _before_ initializing any DP8 connection point object (peer/client/server). The initialization sequence is:CoCreate DP8Server;CoCreate DP8ThreadPool;DP8ThreadPool->Initialize(...);DP8Server->Initialize(...);  And to shut down you do the following:DP8Server->CancelAsyncOperation( NULL, DPNCANCEL_ALL_OPERATIONS );DP8Server->Close( 0 );DP8Server->Release();DP8ThreadPool->Close( 0 );DP8ThreadPool->Release( );  -cb ;  Thanks for the reply.Maybe I wasn''t too clear in my post. What I meant was that I have a client and a server interface running in the same process.Both interfaces are wrapped inside their own class. To prevent coupling between these classes (CClient, CServer), each class attempts to initialize a thread pool interface internally before they initialize either a DirectPlay client or a DirectPlay server interface.If I first instantiate a CServer and then a CClient in the same process (to both host and run the game on the same computer), internally the CClient will return DPNERR_ALREADYINITIALIZED when attempting to initialize the thread pool interface because the CServer already has initialized its thread pool.I''m assuming that the thread pool interface in CServer now controls both when the CServer and the CClient class works. But my question is: Is it canon to call ::DoWork() on the thread pool interface that "failed" with DPNERR_ALREADYINITIALIZED (i.e. in CClient)?Currently, that''s what I''m doing, without errors. I''m just wondering if it''s "pretty" or I should move the thread pool outside the two classes and manage it in an independent class?Best regardsBjørn Toft Madsen ;  > Both my client and my server class does something like...> //set up IDirectPlay8ThreadPool> IDirectPlay8ThreadPool::InitializeThat''s the problem. As I stated above,  DP8 uses the same thread pool for all DP objects within the same application; this is documented.   Therefore you can only have ONE   thread pool object per process. You should remove the thread pool bundle you have made with the client and server objects and make it a singleton. And this thread pool singleton controls ALL   of your DP8 objects in the process, so that ONE    call to ::DoWork() will process both your client and server objects.-cb