MCPcopy Index your code
hub / github.com/nodejs/node / LoadTargetBuildFilesParallel

Function LoadTargetBuildFilesParallel

tools/gyp/pylib/gyp/input.py:606–661  ·  view source on GitHub ↗
(
    build_files, data, variables, includes, depth, check, generator_input_info
)

Source from the content-addressed store, hash-verified

604
605
606def LoadTargetBuildFilesParallel(
607 build_files, data, variables, includes, depth, check, generator_input_info
608):
609 parallel_state = ParallelState()
610 parallel_state.condition = threading.Condition()
611 # Make copies of the build_files argument that we can modify while working.
612 parallel_state.dependencies = list(build_files)
613 parallel_state.scheduled = set(build_files)
614 parallel_state.pending = 0
615 parallel_state.data = data
616
617 try:
618 parallel_state.condition.acquire()
619 while parallel_state.dependencies or parallel_state.pending:
620 if parallel_state.error:
621 break
622 if not parallel_state.dependencies:
623 parallel_state.condition.wait()
624 continue
625
626 dependency = parallel_state.dependencies.pop()
627
628 parallel_state.pending += 1
629 global_flags = {
630 "path_sections": globals()["path_sections"],
631 "non_configuration_keys": globals()["non_configuration_keys"],
632 "multiple_toolsets": globals()["multiple_toolsets"],
633 }
634
635 if not parallel_state.pool:
636 parallel_state.pool = multiprocessing.Pool(multiprocessing.cpu_count())
637 parallel_state.pool.apply_async(
638 CallLoadTargetBuildFile,
639 args=(
640 global_flags,
641 dependency,
642 variables,
643 includes,
644 depth,
645 check,
646 generator_input_info,
647 ),
648 callback=parallel_state.LoadTargetBuildFileCallback,
649 )
650 except KeyboardInterrupt as e:
651 parallel_state.pool.terminate()
652 raise e
653
654 parallel_state.condition.release()
655
656 parallel_state.pool.close()
657 parallel_state.pool.join()
658 parallel_state.pool = None
659
660 if parallel_state.error:
661 sys.exit(1)
662
663

Callers 1

LoadFunction · 0.85

Calls 12

ParallelStateClass · 0.85
globalsFunction · 0.85
acquireMethod · 0.80
popMethod · 0.80
releaseMethod · 0.80
closeMethod · 0.65
listFunction · 0.50
setFunction · 0.50
waitMethod · 0.45
terminateMethod · 0.45
joinMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…