Skip to content

WrappedThread ​

com.jsmacrosce.jsmacros.graal.language.impl.WrappedThread

Associates a Java thread with its Graal task-queue priority and a one-way readiness signal.

js
const WrappedThread = Java.type("com.jsmacrosce.jsmacros.graal.language.impl.WrappedThread");  
const Thread = Java.type("java.lang.Thread");  
const task = new WrappedThread(Thread.currentThread(), 5);  
task.notifyReady();  
task.waitUntilReady(); // already signaled: returns without parking

Do not block a script waiting for a notifier that has not been scheduled.

Constructors ​

new WrappedThread ​

new WrappedThread(Thread thread, int priority)#
Stores the thread and queue priority; the readiness signal starts unset.

Parameters:

  • thread: Java thread represented by this task
  • priority: Graal task-queue priority, not Java thread priority

Fields ​

priority ​

priority: intread-only#
Graal task-queue priority value, not a Thread.setPriority value.

thread ​

thread: Threadread-only#
The Java thread represented by this task; this reference is not copied or started.

Methods ​

notifyReady ​

notifyReady(): void#
Sets readiness and unparks the represented thread; readiness is one-way.

waitUntilReady ​

waitUntilReady(): void#
Waits for readiness on the represented thread; another caller receives an AssertionError. Parks while not ready. After each park, an interrupt clears the current thread's interrupt status and causes InterruptedException; an already-ready call returns without checking it.