Setting thread priorities

Grant Edwards grante at visi.com
Sun May 13 10:52:24 EDT 2007


On 2007-05-13, Gerald Kaszuba <gerald.kaszuba at gmail.com> wrote:
> Hi John
>
> On May 13, 4:46 pm, John Nagle <n... at animats.com> wrote:
>>    There's no way to set thread priorities within Python, is there?
>
> Not exactly. You can however use the ctypes module to access the o/s
> methods of pthread_setschedparam() for UNIX and SetThreadPriority()
> for Windows.
>
> I'm not sure why this hasn't been implemented in Python.

AFAICT, Python's threading paradigm seems to be based on the
assumption that alls threads spend most of their time blocking
on I/O or some other event.  In that case priorities don't
matter. Priorities only matter if multiple threads are ready to
run.

-- 
Grant Edwards
grante at visi.com



More information about the Python-list mailing list