• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling suspend() from within a thread

 
Warren Dew
blacksmith
Ranch Hand
Posts: 1332
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand why calling suspend() from outside a thread is inherently deadlock prone, since one can't tell whether the thread has any locks.

But what about calling suspend() from within the thread itself, say from within the run() method? It seems to me that this is not inherently deadlock prone, since one can tell, from within the thread, what monitors one has locked.

And


is so much cleaner than

[ September 22, 2004: Message edited by: Warren Dew ]
 
Henry Wong
author
Sheriff
Posts: 22530
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It shouldn't be that hard to try it out. Just write a short program with a single line that suspends the current thread.

IMO, it probably won't work, but I would be interested to hear about the results.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!