52 lines
1.9 KiB
Plaintext
52 lines
1.9 KiB
Plaintext
From: eric at linux-hw.com (Eric Lee Green)
|
|
Date: Tue, 13 Apr 1999 21:32:23 GMT
|
|
Subject: threads
|
|
In-Reply-To: <1288080841-20523503@hypernet.com>
|
|
References: <1288080841-20523503@hypernet.com>
|
|
Message-ID: <Pine.LNX.4.04.9904131722450.14793-100000@england.local.net>
|
|
Content-Length: 1569
|
|
X-UID: 358
|
|
|
|
On Tue, 13 Apr 1999, Gordon McMillan wrote:
|
|
|
|
> Eric Lee Green wonders about Python threads:
|
|
>
|
|
> > My question is this: How "atomic" are basic Python variable
|
|
> > operations?
|
|
>
|
|
> This exact question was asked not long ago. My reply, and Guido's
|
|
> clarifications follow:
|
|
|
|
Ah. Okay. So Python is doing user-land threads and not Posix (OS-level)
|
|
threads?
|
|
|
|
The difference between the two doesn't make a difference for my
|
|
application, but I'd be curious to know in case I ever want to run this on
|
|
an SMP machine (where only OS-level threads are schedulable on multiple
|
|
processors).
|
|
|
|
In any event, I'm relieved to know that basic operations are safe. As long
|
|
as the semaphoring requirements are similar to "C", which appears to be
|
|
the case, I am just fine. I do see, from reading the documentation, that
|
|
file I/O operations are thread-safe. The only question then is whether
|
|
Python's socket operations are thread-safe if we're doing user-land
|
|
threads... I'd hate to bring all threads to a halt by reading from a
|
|
socket, because that was the whole point (to be able to do things
|
|
asynchronously).
|
|
|
|
Be a real bummer if I have to stop what I'm doing and start re-writing it
|
|
all into C++ :-(. (I am *NOT* fond of C++, it seems you have to spend eons
|
|
writing basic classes to do things that Python does out of the box before
|
|
you can even think about your application).
|
|
|
|
--
|
|
Eric Lee Green eric at linux-hw.com http://www.linux-hw.com/~eric
|
|
"People have grown used to thinking of computers as unreliable, and it
|
|
doesn't have to be that way." -- Linus
|
|
|
|
|
|
|
|
|
|
|
|
|