mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8338146: Improve Exchanger performance with VirtualThreads
Reviewed-by: alanb
This commit is contained in:
parent
e297e8817f
commit
ab8071d280
3 changed files with 251 additions and 329 deletions
|
@ -426,8 +426,8 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
|
|||
long deadline = (timed) ? System.nanoTime() + ns : 0L;
|
||||
boolean upc = isUniprocessor; // don't spin but later recheck
|
||||
Thread w = Thread.currentThread();
|
||||
if (w.isVirtual()) // don't spin
|
||||
spin = false;
|
||||
if (spin && ForkJoinWorkerThread.hasKnownQueuedWork())
|
||||
spin = false; // don't spin
|
||||
int spins = (spin & !upc) ? SPINS : 0; // negative when may park
|
||||
while ((m = item) == e) {
|
||||
if (spins >= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue