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? e.g. class IoThread: # ... # called from the other thread... def RequestFile(self, name): self.fileQueue.append(name) # called during the IO thread def GetNextFile(self); next = self.fileQueue[0] self.fileQueue.pop(0) return next ? -tom! -- http://mail.python.org/mailman/listinfo/python-list