int get_input_handle(void) { static int h = -1; if (h >= 0) return h; if (be_pipe(ihpipe) < 0) return -1; if ((inth = start_thr(input_handle_th, NULL, "input_thread")) < 0) { closesocket(ihpipe[0]); closesocket(ihpipe[1]); fatal_exit("Can't spawn input thread"); } return h = ihpipe[0]; }
int get_input_handle() { static int h = -1; if (h >= 0) return h; if (be_pipe(ihpipe) < 0) return -1; if ((inth = start_thr(input_handle_th, NULL, "input_thread")) < 0) { closesocket(ihpipe[0]); closesocket(ihpipe[1]); return -1; } return h = ihpipe[0]; }
int get_output_handle(void) { static int h = -1; if (h >= 0) return h; if (be_pipe(ohpipe) < 0) return -1; if (start_thr(output_handle_th, NULL, "output_thread") < 0) { closesocket(ohpipe[0]); closesocket(ohpipe[1]); return -1; } return h = ohpipe[1]; }