to py or not to py ?
Steve Holden
steve at holdenweb.com
Thu Jun 29 08:46:24 EDT 2006
Tom Plunket wrote:
> Carl J. Van Arsdall wrote:
>
>
>>Because of the GIL only one thread can actually run at a time.
>
>
> I've recently been wondering about this, since in the work I do, a lot
> of time is spent doing disk I/O. So if I want the UI to remain
> responsive, I could spawn an IO thread to handle requests, and do a
> pretty simple "just whack new requests onto the queue" without locks
> since I'm guaranteed to not have the IO thread read at the same time
> as the requestor thread?
>
> ...what exactly constitutes an atomic operation in Python, anyway?
>
Standard (and excellent) advice to those new to Python: use threading,
not thread, and have threads communicate using Queue.Queue(s).
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Love me, love my blog http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden
More information about the Python-list
mailing list