REPOST: Re: values of sys.platform? for a serial port lib

Chris Liechti cliechti at gmx.net
Sat Dec 29 19:41:29 EST 2001


Peter Hansen <peter at engcorp.com> wrote in
news:3C2E543D.4BFB07D at engcorp.com: 
> Between links on Unix, third-party serial port devices under
> Windows which might not use the COMx convention, and other such
> variations, I'd strongly recommend you *not* try to use an
> index origin of 0 but instead pass the open() routine (or
> whatever you have) a *string* naming the serial port.

i want it to run mainly on win32 and linux. the user of the lib should not 
need to care about device names.
i use a function to create the device string so the real numbering with 
numbers and/or letters is no problem.
 
i also have an optional argument to specify the port string, but when this 
is used it isn't portable anymore.

> By the way, does your win32 implementation work well with
> threads, if one thread is trying to read from the port while
> the other is trying to write to it?

i haven't tested it that way. i use it in a multi-threaded environment, but 
the class that accesses the serial port (and generates binary communication 
frames) uses means from the module threading.

the lib just calls the underlying functions from the os, so no thread 
safety from there.

chris

-- 
Chris <cliechti at gmx.net>

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Chris Liechti <cliechti at gmx.net>
Newsgroups: comp.lang.python
Subject: cmsg cancel <Xns918711A025136cliechtigmxnet at 62.2.16.82>
Control: cancel <Xns918711A025136cliechtigmxnet at 62.2.16.82>
Date: Mon, 31 Dec 2001 02:04:41 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: <cancel.Xns918711A025136cliechtigmxnet at 62.2.16.82>
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774450 27193 211.57.49.2 (31 Dec 2001 04:54:10 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:54:10 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.



More information about the Python-list mailing list