Basically I want to write a piece of code in threads (i.e. I need to execute the function for each object of the class)
My basic functionality is given as
def run(self):
    while True:
        functionCall() #This is a function which uses network, so it might take variable amount of time
But What I want to do is
def run(self):
    while True:
        # Try executing the below for N milli seconds
        functionCall()
        #else execute the below block
        timeoutCall()
I know I can do it with the help of SIGALARM in case of the wait time is in seconds. but unfortunately. I can spend only less time waiting(in milliseconds).Hoping for a good method to do it.
Thanks in advance