Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

IO error in synchronized block  RSS feed

 
Thomas Lory
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When one thread th1 is processing a synchronized block,
another thread th2 is waiting to get processed..

If 1st thread fails while processing an IO, what will happen ?

Thanks,
Lory
 
Henry Wong
author
Sheriff
Posts: 22840
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably need to clarify a bit more, as your example is very general.

However, generally, the second thread that is blocked on a lock, can't obtain the lock until the first thread releases it. And the first thread will release it when it leaves the synchronized block -- regardless of whether there is an I/O error or not.... meaning it does not matter how it leaves the block. If it leaves the block, it releases the lock.


And BTW, welcome to the ranch.

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