Multithreading / multiprocess

TennesseeLeeuwenburg tleeuwenburg at
Sun Apr 12 13:26:28 CEST 2009

On Apr 11, 10:39 pm, "Diez B. Roggisch" <de... at> wrote:
> tleeuwenb... at schrieb:
> > Is there anyway to begin a thread and execute a finite number of lines
> > of code, or a finite amount of time within it?
> > For example, say I create three child threads and I want to guarantee
> > equal timeshare between them, can I specify a quanta (say 400 LOC
> > although I know that is pretty small) to execute in each one in turn?
> Not as such, no. You can play tricks with the trace-module, but these
> ultimately fail when the code in question runs inside C - which puts a
> stop to any python interpreter scheduling anyway, thus native threads
> are used which can't be controlled on that level.
> Diez

Mmmm good point. 1 line of Python != 1 line of C. That's probably not
very important for what I have in mind, but I hadn't really been
considering that angle.


More information about the Python-list mailing list