I have the following python script. I want to repeatedly execute timer
function after every 10 seconds which I am running asynchronously. I looked at post1 and post2 but they are not returning any value.
import threading
def timer(bar, baz):
print 'hello {0}'.format(bar)
return 'foo' + baz
from multiprocessing.pool import ThreadPool
pool = ThreadPool(processes=1)
async_result = pool.apply_async(timer, ('world', 'foo'))
return_val = async_result.get()
print return_val
Is there a way to get the value after every t time intervals while main thread is still doing some other job?