Hey everyone :)
I wish to know how can I translate a "busy waiting loop" approach into an event driven approach
Lets say I have a queue of tasks, whenever there are elements in the queue, a process has to treat these elements
Now I do it like this:
while(1){
if(MyQ.Size()>0){
My.Q.RemoveHead ....
}
}
This approach causes the cpu to work on full load, even if there are no elements in the queue.
Is there a way to avoid this loop and somehow to create an event driven approach. Something like OnQueueHasElements...
Thanks in advance :)