Can anybody give a simple Deadlock sample code in c# ? And please tell the simplest way to find deadlock in your C# code sample. (May be the tool which will detect the dead
To answer the part of your question about deadlock detection, I rather doubt that this is in general possible. It is similar in question with the halting problem, you cannot effectively compute the semantics. One way to overcome this is to use a watchdog which would periodically poll each thread if it is still alive and give it a certain timeout to answer, if 2 threads do not respond, you can assume they are either to busy or they are dead-locked.