79.1k views
4 votes
What method in the C# is used to move one thread from the "wait" state to the "ready" state?

1) notify
2) notifyAll
3) wait
4) sleep

User Bosch
by
7.3k points

1 Answer

2 votes

Final answer:

The methods for moving a thread from the 'wait' state to the 'ready' state in C# are Monitor.Pulse and Monitor.PulseAll; notify and notifyAll are Java methods, not C#.

Step-by-step explanation:

In C#, the method used to move one thread from the "wait" state to the "ready" state is Monitor.Pulse or Monitor.PulseAll. These are the closest analogs to the notify and notifyAll methods found in Java. The Monitor.Wait method puts a thread into the wait state, and Thread.Sleep is used to make the current thread pause for a specified period of time. It should be noted that the options provided in the question such as notify, notifyAll, and wait are from Java, not C#. In C#, Monitor is the class used for this purpose.