bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/111587] Running a native process may introduce up to 1 se


From: guillerodriguez.dev at gmail dot com
Subject: [Bug classpath/111587] Running a native process may introduce up to 1 second additional delay
Date: Mon, 25 Sep 2023 09:40:02 +0000

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111587

--- Comment #1 from Guillermo Rodriguez <guillerodriguez.dev at gmail dot com> 
---
The java.lang.VMProcess class uses a dedicated thread that does all the
fork()'ing and wait()'ing for external processes. This threads sleeps when
there is no more work to do:

    // If there are more new processes to create, go do that now.
    // If there is nothing left to do, exit this thread. Otherwise,
    // sleep a little while, and then check again for reapable children.
    // We will get woken up immediately if there are new processes to
    // spawn, but not if there are new children to reap. So we only
    // sleep a short time, in effect polling while processes are active.

    [...]
    try
      {
        workList.wait(MAX_REAP_DELAY);
      }

(MAX_REAP_DELAY = 1000 ms)

A simple fix to avoid this unnecessary delay would be to call workList.notify
from VMProcess.waitFor and VMProcess.destroy.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]