]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Add a mini-rant to the top comment explaining why threads are
authorSimon Tatham <anakin@pobox.com>
Sun, 3 Sep 2006 12:55:16 +0000 (12:55 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 3 Sep 2006 12:55:16 +0000 (12:55 +0000)
required. (I just tried getting rid of them; it worked fine for
serial ports, but not for anything else. The Windows I/O API sucks.)

[originally from svn r6843]

windows/winhandl.c

index 222e5b9319ec7135c4941569f4cdbb676d5d59a0..b5f0b8599182658102c93dfe090b31eb33de511b 100644 (file)
  * write; so the output thread waits for an event object notifying
  * it to _attempt_ a write, and then it sets an event in return
  * when one completes.
+ * 
+ * (It's terribly annoying having to spawn a subthread for each
+ * direction of each handle. Technically it isn't necessary for
+ * serial ports, since we could use overlapped I/O within the main
+ * thread and wait directly on the event objects in the OVERLAPPED
+ * structures. However, we can't use this trick for some types of
+ * file handle at all - for some reason Windows restricts use of
+ * OVERLAPPED to files which were opened with the overlapped flag -
+ * and so we must use threads for those. This being the case, it's
+ * simplest just to use threads for everything rather than trying
+ * to keep track of multiple completely separate mechanisms.)
  */
 
 #include <assert.h>