This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

IO error in synchronized block

 
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: 22542
109
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
 
That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!