i want to write an application peer to peer program, this is my piece of code.
public void ArrestaServer()
{
if (ThreadAscolta.ThreadState==ThreadState.Running)
ThreadAscolta.Suspend();
}
public void AvviaServer()
{
if (ThreadAscolta == null)
{
ThreadAscolta = new Thread(ServerRicevi);
ThreadAscolta.Start();
while (!(ThreadAscolta.IsAlive)) ;
}
else if (ThreadAscolta.ThreadState==ThreadState.SuspendRequested)
ThreadAscolta.Resume();
}
How can i remove these alerts?
System.Threading.Thread.Resume(): "Thread.Resume has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources."
System.Threading.Thread.Suspend(): "Thread.Suspend has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources."