Lines Matching defs:workers
86 * sends writeheader()'s and lists of daddr's to the workers via pipes.
87 * The following structure defines the instruction packets sent to workers.
95 #define WORKERS 3 /* 1 worker writing, 1 reading, 1 for slack */
107 } workers[WORKERS+1];
141 for (i = 0; i <= WORKERS; i++) {
144 workers[i].tblock = (char (*)[TP_BSIZE])
146 workers[i].req = (struct req *)workers[i].tblock - ntrec - 1;
148 wp = &workers[0];
292 if (++wp >= &workers[WORKERS])
293 wp = &workers[0];
312 for (i = 0; i < WORKERS; i++) {
313 if (workers[i].sent) {
314 if (atomic_read(workers[i].fd,
320 workers[i].sent = 0;
360 for (f = 0; f < WORKERS; f++) {
369 if (workers[f].sent) {
370 if (atomic_read(workers[f].fd, &got, sizeof got)
375 workers[f].sent = 0;
382 (void) close(workers[f].fd);
384 while (wait(NULL) >= 0) /* wait for any signals from workers */
464 twp = &workers[WORKERS];
468 * Each of the N workers should have requests that need to
470 * (workers[WORKERS]) to construct request lists to be sent to
473 for (i = 0; i < WORKERS; i++) {
515 if (++wp >= &workers[WORKERS])
516 wp = &workers[0];
546 * Clear the first workers' response. One hopes that it
683 create_workers(); /* Share open tape file descriptor with workers */
742 * proceed - handler for SIGUSR2, used to synchronize IO between the workers.
763 for (i = 0; i < WORKERS; i++) {
764 if (i == wp - &workers[0]) {
771 (workers[i].pid = fork()) < 0)
772 quite(errno, "too many workers, %d (recompile smaller)",
775 workers[i].fd = cmd[1];
776 workers[i].sent = 0;
777 if (workers[i].pid == 0) { /* Slave starts up here */
779 (void) close(workers[j].fd);
787 for (i = 0; i < WORKERS; i++)
788 (void) atomic_write(workers[i].fd,
789 &workers[(i + 1) % WORKERS].pid,
790 sizeof workers[0].pid);
800 for (i = 0; i < WORKERS; i++)
801 if (workers[i].pid > 0) {
802 (void) kill(workers[i].pid, SIGKILL);
803 workers[i].sent = 0;