On Mon, 26 Jan 2026 17:17:44 GMT, Kevin Rushforth <[email protected]> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/sg/prism/NGGroup.java 
>> line 218:
>> 
>>> 216:         for (int i = (startPos == -1 ? 0 : startPos); i < 
>>> orderedChildren.size(); i++) {
>>> 217:             NGNode child = orderedChildren.get(i);
>>> 218:             child.render(g);
>> 
>> more on the concurrency here: if one would instrument the get(int) method in 
>> `children`  like so
>> 
>> 
>>     private final List<NGNode> children = new ArrayList<>(1) {
>>         public NGNode get(int ix) {
>>             System.out.println(Thread.currentThread());
>>             return super.get(ix);
>>         }
>>     };
>> 
>> 
>> the log will show accesses from two threads:
>> 
>> 
>> Thread[#33,JavaFX Application Thread,5,main]
>> ...
>> Thread[#28,QuantumRenderer-0,5,main]
>> ...
>> Thread[#33,JavaFX Application Thread,5,main]
>> 
>> 
>> The access pattern for `viewOrderChildren` seem to show only QuantumRenderer 
>> thread, though I did not test extensively.
>> 
>> Does anyone know if these two threads are allowed to run in parallel, or is 
>> there a mechanism in place that ensures mutual exclusion?
>
> Yes, this is expected. No, the threads do not run in parallel. The renderLock 
> mechanism prevents it. The only access from the JavaFX Application thread is 
> while holding the render lock to update the render graph (NG* nodes) from the 
> scene graph.

A bit unrelated, but what does the "NG" in "NGNode" stand for?

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/2043#discussion_r2728827941

Reply via email to