Skip to content

Commit 9d685ec

Browse files
committed
Catch all throwables while waiting, not just InterruptedException.
1 parent d4ed074 commit 9d685ec

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/scala/com/github/yruslan/channel/Channel.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ abstract class Channel[T] extends ReadChannel[T] with WriteChannel[T] {
197197
try {
198198
cwr.await()
199199
} catch {
200-
case ex: InterruptedException =>
200+
case ex: Throwable =>
201201
writers -= 1
202202
cwr.signal()
203203
throw ex
@@ -210,7 +210,7 @@ abstract class Channel[T] extends ReadChannel[T] with WriteChannel[T] {
210210
try {
211211
awaiter.await(cwr)
212212
} catch {
213-
case ex: InterruptedException =>
213+
case ex: Throwable =>
214214
writers -= 1
215215
cwr.signal()
216216
throw ex
@@ -223,7 +223,7 @@ abstract class Channel[T] extends ReadChannel[T] with WriteChannel[T] {
223223
try {
224224
crd.await()
225225
} catch {
226-
case ex: InterruptedException =>
226+
case ex: Throwable =>
227227
readers -= 1
228228
crd.signal()
229229
throw ex
@@ -236,7 +236,7 @@ abstract class Channel[T] extends ReadChannel[T] with WriteChannel[T] {
236236
try {
237237
awaiter.await(crd)
238238
} catch {
239-
case ex: InterruptedException =>
239+
case ex: Throwable =>
240240
readers -= 1
241241
crd.signal()
242242
throw ex
@@ -369,7 +369,7 @@ object Channel {
369369
true
370370
}
371371
} catch {
372-
case ex: InterruptedException =>
372+
case ex: Throwable =>
373373
removeWaiters(sem, sel, sel.length)
374374
throw ex
375375
}

0 commit comments

Comments
 (0)