Hello,
I've been working on a thread which will live aslong as the application is running, and runs at a interval of 500ms. I noted that i could be uselessly processing if there's nothing in the queue for it to process, so i went around looking at some sources i had locally, and i found an example close to mine, but it's in Java.
The example had this:
synchronized(this) {
try {
wait();
} catch (InterruptedException e) {
cleanup();
break;
}
}
Inside a while loop which goes on forever.
The thread has this to notify the wait:
synchronized(this) {
notifyAll();
}
This was inside the enqueue thread. I'd also like you to note that the class inherits Runnable.
Could anyone quickly explain the corresponding functions in C#? And maybe an example if you could!
Thanks in advanced, AJ Ravindiran.