| 98 | /* CLI flag wiring: raw argv values for --gpu-vram and --gpu-devices. |
| 99 | * Resolved post-parse via parse_gpu_vram_arg(). */ |
| 100 | const char *gpu_vram_arg; |
| 101 | const char *gpu_devices_arg; |
| 102 | } cli_config; |
| 103 | |
| 104 | static volatile sig_atomic_t cli_interrupted; |
| 105 | static volatile sig_atomic_t cli_dist_busy; |
| 106 | static volatile sig_atomic_t cli_dist_notice_printed; |
| 107 | |
| 108 | static const char cli_dist_drain_msg[] = |
| 109 | "\nds4: stopping after the distributed cluster finishes the current token/chunk...\n"; |
| 110 | |
| 111 | static void cli_sigint_handler(int sig) { |
| 112 | (void)sig; |
| 113 | cli_interrupted = 1; |
| 114 | if (cli_dist_busy && !cli_dist_notice_printed) { |
| 115 | cli_dist_notice_printed = 1; |
| 116 | ssize_t ignored = write(STDERR_FILENO, |
| 117 | cli_dist_drain_msg, |
| 118 | sizeof(cli_dist_drain_msg) - 1u); |
| 119 | (void)ignored; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | static bool cli_interrupt_requested(void) { |
| 124 | return cli_interrupted != 0; |
| 125 | } |
| 126 | |
| 127 | static void cli_interrupt_clear(void) { |
| 128 | cli_interrupted = 0; |
| 129 | cli_dist_notice_printed = 0; |
| 130 | } |
| 131 | |
| 132 | static bool cli_distributed_coordinator(const cli_config *cfg) { |
no test coverage detected