+
+ if (!sending && back->sendok()) {
+ /*
+ * Create a separate thread to read from stdin. This is
+ * a total pain, but I can't find another way to do it:
+ *
+ * - an overlapped ReadFile or ReadFileEx just doesn't
+ * happen; we get failure from ReadFileEx, and
+ * ReadFile blocks despite being given an OVERLAPPED
+ * structure. Perhaps we can't do overlapped reads
+ * on consoles. WHY THE HELL NOT?
+ *
+ * - WaitForMultipleObjects(netevent, console) doesn't
+ * work, because it signals the console when
+ * _anything_ happens, including mouse motions and
+ * other things that don't cause data to be readable
+ * - so we're back to ReadFile blocking.
+ */
+ idata.event = stdinevent;
+ if (!CreateThread(NULL, 0, stdin_read_thread,
+ &idata, 0, &threadid)) {
+ fprintf(stderr, "Unable to create second thread\n");
+ exit(1);
+ }
+ sending = TRUE;
+ }
+