On Wed, 24 Apr 2024 14:54:34 GMT, Viktor Klang <[email protected]> wrote:
>> Currently we have
>>
>> public void writeTo(OutputStream out) throws IOException {
>> if (Thread.currentThread().isVirtual()) {
>> out.write(toByteArray());
>> } else synchronized (this) {
>> out.write(buf, 0, count);
>> }
>> }
>>
>> where `toByteArray()` is `synchronized`, but here I would think that we'd
>> want to replace it with simply `Arrays.copyOf(buf, count)` without the
>> `synchronized`, no?
>
> @bplb My interpretation was that we didn't want to hold the monitor *during*
> out.write().
Please see 8076291fb3d097ef67d0b59b9be3c8b762aad7cf.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18901#discussion_r1578116805