B
Bob Dankert
Ok, so this seems like it should be simple, and it is probably because I am
so tired that I do not see the answer. How do I make a function wait for
something to be set in a multi-threaded environment? For example, I have a
class with a boolean value which is true or false. In this class, there is
a method running which needs to wait for the boolean to be true. Another
process will change the boolean from false to true. What is the best way to
wait for the boolean to be true??
If I do: while (boolean != false) {} It eats up 100% of resources and
kills the program.
If I do: while (boolean != false) {Application.DoEvents();} It does not
kill the program, but it still uses 98% of the cpu
It seems to me like I am missing something really obvious, I appreciate any
help!!
Thanks,
Bob Dankert
so tired that I do not see the answer. How do I make a function wait for
something to be set in a multi-threaded environment? For example, I have a
class with a boolean value which is true or false. In this class, there is
a method running which needs to wait for the boolean to be true. Another
process will change the boolean from false to true. What is the best way to
wait for the boolean to be true??
If I do: while (boolean != false) {} It eats up 100% of resources and
kills the program.
If I do: while (boolean != false) {Application.DoEvents();} It does not
kill the program, but it still uses 98% of the cpu
It seems to me like I am missing something really obvious, I appreciate any
help!!
Thanks,
Bob Dankert