1
Fork 0

Update comments on Windows job objects

This commit is contained in:
Chris Denton 2024-12-05 03:45:05 +00:00
parent a89f340efe
commit 898d75122f
No known key found for this signature in database
GPG key ID: 713472F2F45627DE
2 changed files with 7 additions and 4 deletions

View file

@ -1184,6 +1184,8 @@ def bootstrap(args):
args = [build.bootstrap_binary()]
args.extend(sys.argv[1:])
env = os.environ.copy()
# The Python process ID is used when creating a Windows job object
# (see src\bootstrap\src\utils\job.rs)
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
env["BOOTSTRAP_PYTHON"] = sys.executable
run(args, env=env, verbose=build.verbose, is_bootstrap=True)

View file

@ -15,11 +15,12 @@ pub unsafe fn setup(build: &mut crate::Build) {
///
/// Most of the time when you're running a build system (e.g., make) you expect
/// Ctrl-C or abnormal termination to actually terminate the entire tree of
/// process in play, not just the one at the top. This currently works "by
/// processes in play. This currently works "by
/// default" on Unix platforms because Ctrl-C actually sends a signal to the
/// *process group* rather than the parent process, so everything will get torn
/// down. On Windows, however, this does not happen and Ctrl-C just kills the
/// parent process.
/// *process group* so everything will get torn
/// down. On Windows, however, Ctrl-C is only sent to processes in the same console.
/// If a process is detached or attached to another console, it won't receive the
/// signal.
///
/// To achieve the same semantics on Windows we use Job Objects to ensure that
/// all processes die at the same time. Job objects have a mode of operation