Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread - suspend()

 
Deepti Dixit
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic