vijay1440 0 Posted May 1, 2008 Report Share Posted May 1, 2008 Hi,I want to know how can we make the threads wait for an Object. Can you please give any suggestions?Thank you very much,Vijay Quote Link to post Share on other sites
jesh 0 Posted May 1, 2008 Report Share Posted May 1, 2008 Conceptually, one suggestion would be that you make the thread check for some state (i.e. the object is loaded), if it isn't there, sleep for a bit. When it stops sleeping, check for the state. If it isn't there, sleep for a bit.pseudo-code: private void WaitForState(){ if(object is null) { sleep(); WaitForState(); }} Quote Link to post Share on other sites
vijay1440 0 Posted May 7, 2008 Author Report Share Posted May 7, 2008 Thank you very much for the suggestion. I guess this may work. And I have something else in mind. Shall we have some method on object like wait, which we can invoke to wait till it is not used by anyone? Conceptually, one suggestion would be that you make the thread check for some state (i.e. the object is loaded), if it isn't there, sleep for a bit. When it stops sleeping, check for the state. If it isn't there, sleep for a bit.pseudo-code:private void WaitForState(){ if(object is null) { sleep(); WaitForState(); }} Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.