示例#1
0
def thread_func(name, pri):
    """
    The priorities do appear to make some difference,
    even in such a heavily IO-bound case.
    """
    miso.set_thread_priority(pri)
    for i in range(100):
        logwrite("%s: %d" % (name, i))
示例#2
0
        e32.ao_yield()

# --------------------------------------------------------------------

def thread_func(name, pri):
    """
    The priorities do appear to make some difference,
    even in such a heavily IO-bound case.
    """
    miso.set_thread_priority(pri)
    for i in range(100):
        logwrite("%s: %d" % (name, i))

main_tpri = miso.get_thread_priority()
tell("main thread has priority %d" % main_tpri)
miso.set_thread_priority(main_tpri)
main_tpri = miso.get_thread_priority()
tell("main thread has priority %d" % main_tpri)

main_ppri = miso.get_process_priority()
tell("main process has priority %d" % main_ppri)
miso.set_process_priority(main_ppri)
main_ppri = miso.get_process_priority()
tell("main process has priority %d" % main_ppri)

tids = [thread.start_new_thread(thread_func, ("muchless", -20)),
        thread.start_new_thread(thread_func, ("less", -10)),
        thread.start_new_thread(thread_func, ("normal", 0)),
        thread.start_new_thread(thread_func, ("more", 10))]
tell("threads started")
for tid in tids: