Multithreading / multiprocess
Diez B. Roggisch
deets at nospam.web.de
Sat Apr 11 14:39:21 CEST 2009
tleeuwenburg at gmail.com 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.
More information about the Python-list