Skip to content

Commit 279f33c

Browse files
committed
wrap call to go with evalOnVirtualThreadIfAvailable
1 parent c6d1146 commit 279f33c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

io/jvm/src/main/scala/fs2/io/net/unixsocket/UnixSocketsPlatform.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,11 @@ private[unixsocket] trait UnixSocketsCompanionPlatform {
107107

108108
def write(bytes: Chunk[Byte]): F[Unit] = {
109109
def go(buff: ByteBuffer): F[Unit] =
110-
evalOnVirtualThreadIfAvailable(
111-
F.blocking(ch.write(buff)).cancelable(close) *>
112-
F.delay(buff.remaining <= 0).ifM(F.unit, go(buff))
113-
)
110+
F.blocking(ch.write(buff)).cancelable(close) *>
111+
F.delay(buff.remaining <= 0).ifM(F.unit, go(buff))
114112

115113
writeMutex.lock.surround {
116-
F.delay(bytes.toByteBuffer).flatMap(go)
114+
F.delay(bytes.toByteBuffer).flatMap(buffer => evalOnVirtualThreadIfAvailable(go(buffer)))
117115
}
118116
}
119117

0 commit comments

Comments
 (0)