Originally posted by Deepti Dixit: Why should the following code even complile ? Isn't suspend() supposed to be called by some other thread on the current thread ? It prints "Test" and hangs there!
Well first of all suspend and resume are deprecated & yes you are right that other threads should call suspend, in this context the thread itself is calling suspend and there is no other thread which you have created which will resume the thread which is suspended. There is no reason to get compiler error, the code is perfectly ok and passes the compiler check.