From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d0077c2a3f44fc09 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit From: Brian May Newsgroups: comp.lang.ada Subject: Re: Port LPT + ADA (whta do I wrong?) References: <1gr5159dmj2vk.5tkxiw6kxrmv.dlg@40tude.net> <1olbt9ia2fuuo$.qbyglb1cl3g8.dlg@40tude.net> Date: Mon, 13 Dec 2004 09:25:26 +1100 Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:snGF98WzC9uVj4ehDefzsYPcii8= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: snoopy.microcomaustralia.com.au X-Trace: news.melbourne.pipenetworks.com 1102890301 202.173.153.89 (13 Dec 2004 08:25:01 +1000) X-Complaints-To: abuse@pipenetworks.com X-Abuse-Info: Please forward all headers to enable your complaint to be properly processed. Path: g2news1.google.com!news3.google.com!news.glorb.com!newsfeed-east.nntpserver.com!nntpserver.com!news1.optus.net.au!optus!news.mel.connect.com.au!news-south.connect.com.au!news-north.connect.com.au!news.alphalink.com.au!news.melbourne.pipenetworks.com!not-for-mail Xref: g2news1.google.com comp.lang.ada:6910 Date: 2004-12-13T09:25:26+11:00 List-Id: >>>>> "Steve" == Steve writes: Steve> Unless you're speaking about something specific to handling Steve> of the parallel port, I can say for certain that with Steve> serial I/O you must use OVERLAPPED I/O if you want to do Steve> full duplex communication. This is not obvious from the Steve> documentation, but if you dig far enough (and try it) Steve> you'll find that this is the case. Ok, this might be my problem I have encountered with serial I/O, where I read from a serial port in one thread and write to it in another thread... I found sample code that does this (Ada Terminal Emulator at http://www.members.optusnet.com.au/rosshigson/terminal.htm), according to the comment: -- 1. Windows NT is unable to read and write at the same -- time. Attempts to do so result in one or the other -- being blocked. Therefore, by default we use a mutex to -- serialize read and write calls. Windows 95/98 can read -- and write at the same time, so we can use the option -- "/nomutex". This seems kind of dodgy to me, and presumably means if something is to be written it cannot be written until the read call returns. Steve> Before using OVERLAPPED operations I found the little Steve> ideosyncracy that if I had one thread waiting on a read, Steve> another thread couldn't do a write until the read finished. Steve> Using overlapped the write causes the read to wake up, the Steve> write does it's thing. When my code detects that the read Steve> hasn't finished, it goes back and reads again. A pain in Steve> the butt, but it works. Does anyone have sample Ada code that uses OVERLAPPED operations? -- Brian May