MCPcopy Index your code
hub / github.com/git/git / pp_init

Function pp_init

run-command.c:1567–1599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1565}
1566
1567static void pp_init(struct parallel_processes *pp,
1568 const struct run_process_parallel_opts *opts,
1569 struct parallel_processes_for_signal *pp_sig)
1570{
1571 const size_t n = opts->processes;
1572
1573 if (!n)
1574 BUG("you must provide a non-zero number of processes!");
1575
1576 trace_printf("run_processes_parallel: preparing to run up to %"PRIuMAX" tasks",
1577 (uintmax_t)n);
1578
1579 if (!opts->get_next_task)
1580 BUG("you need to specify a get_next_task function");
1581
1582 CALLOC_ARRAY(pp->children, n);
1583 if (!opts->ungroup)
1584 CALLOC_ARRAY(pp->pfd, n * 2);
1585
1586 for (size_t i = 0; i < n; i++) {
1587 strbuf_init(&pp->children[i].err, 0);
1588 child_process_init(&pp->children[i].process);
1589 if (pp->pfd) {
1590 pp->pfd[i].events = POLLIN | POLLHUP;
1591 pp->pfd[i].fd = -1;
1592 }
1593 }
1594
1595 pp_sig->pp = pp;
1596 pp_sig->opts = opts;
1597 pp_for_signal = pp_sig;
1598 sigchain_push_common(handle_children_on_signal);
1599}
1600
1601static void pp_cleanup(struct parallel_processes *pp,
1602 const struct run_process_parallel_opts *opts)

Callers 1

run_processes_parallelFunction · 0.85

Calls 3

strbuf_initFunction · 0.85
child_process_initFunction · 0.85
sigchain_push_commonFunction · 0.85

Tested by

no test coverage detected