Nicing a thread

J

jesper

Hi,

I would like to spawn a thread (on Unix) with a lower priority (higher
niceness) than the main thread (which should stay at nice 0). What I
have done is something like:

import threading, os
class MyThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)

def run(self):
os.nice(19)
a_useful_method()

It seems to work but I am a bit sure whether I missed anything (I am
not that familiar with threading). What do you experts say?

Best regards,
Jesper
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top