How to execute a function in Python based on time provided by seconds argument.
def timerfn(seconds, fn, *args):
#start some timer
#if function first launch is > "seconds", abort
#if function doing great.. repeat it and stop at "seconds"
As i'm thinking over it time.clock() can't really help here, because a function can be really tough and it will not ever reach a counter-timer to show some result or abort.
Do i have to use threading module? i don't know much about threads, but from what i read - you can have only a one thread in work according to GIL, and this process really needs 2 threads at same time.. or some other trick that i don't know.