1

I'm having a problem starting more than 8 threads using threading in Python 2.7 (running on Raspbian Jessie).

If I run

import threading

my_func_1()
my_func_2()
my_func_3()
my_func_4()
my_func_5()
threading.Thread(target=my_func_6).start()
my_func_7()
my_func_8()
my_func_9()#this is never reached
my_func_10()#nor this

where functions 1-5,7-10 have the form:

def my_func_1():
    global some_global_vars
    #do stuff here, involving global and local variables...

    threading.Timer(0.02,my_func_1).start()

and function 6 has the form

def my_func_6():
    while 1:
        #do stuff

then only the first 8 functions get executed. I feel this might be related to thread-per-process limits in linux but I couldn't quite get my head around it. Individually the functions run fine, and it's always the first 8 that execute (regardless of the order they're launched in).

How would I check if it's a thread-per-process issue? Or is it something else altogether?

Antoine Zambelli
  • 724
  • 7
  • 19
  • Try running 10 threads that are all the same function. How many run? – whackamadoodle3000 Oct 08 '17 at 15:55
  • @whackamadoodle3000 Using the most basic function, I can get 10 threads running. Haven't tested with the more intensive functions yet. I managed to get it working by simply combining some functions together. Definitely a hack though... – Antoine Zambelli Oct 08 '17 at 20:35

0 Answers0