Sunny
7/16/2004 1:52:00 PM
Why do you need to suspend the main thread? This is not a good idea. If
you need to make the thread to wait for something, use ManualResetEvent
or AutoResetEvent.
Sunny
In article <ux84owyaEHA.996@TK2MSFTNGP12.phx.gbl>, rundle@rundle.com
says...
> I have a server which exposes a tree of remote objects. The server seems to
> be working fine if I run without the debugger. If I run in the debugger,
> the CPU goes to 100% the first time I access the object from the client.
>
> I''ve tracked the problem down to this bit of code in the main...
>
> [STAThread]
> static void Main(string[] args)
> {
> simulationresources = new joaSimulationResourcesImp();
> simulationresources.Register();
> #if false
> Thread.CurrentThread.Suspend();
> #else
> Console.WriteLine("Return ends server.\n");
> Console.ReadLine();
> #endif
> }
>
> If I change the Suspend() call to the Console.ReadLine() then the debugger
> no longer has a problem. (I also changed the project settings from Windows
> Application to Console Application).
>
> It''s very curious to me that the Suspend() call gives the debugger problems.
> Clearly suspending the main thread is the proper thing to do for the
> deployed server (which will be deployed as a Windows service). Or am I
> wrong on this point?
>
> Regards,
> Bob Rundle
>
>
>
>
>
>
>