Assuming I’m not using the lock statement, is this a bad practice?
public static class Foo { public static string Bar() { bool working; while (working) { // Loop until ready to run. } working = true; // Do stuff here. working = false; return 'done.' } }
Edit –
After trying something like this, I realize it’s not feasible for several reasons. I was just curious.. The example I posted doesn’t even work.
Loop is a CPU consuming process.
I mean if everything you do is just waiting. It is not a good.