sankalpjonn / timeloop

An elegant periodic task executor
MIT License
245 stars 49 forks source link

warning on macOS #17

Open jacopo-massa opened 4 years ago

jacopo-massa commented 4 years ago

I'm using timeloop with pybluez to discover bluetooth devices every x seconds. But during the loop, the following warning is printed:

WARNING: nextEventMatchingMask should only be called from the Main Thread! This will throw an exception in the future.

I'm running the loop in the main thread with tl.start(block=True)

And the loop doesn't continue. How can I solve this problem?

woz5999 commented 4 years ago

Even if block=True, the function is still run in a separate through. The blocking appears to be done artificially solely for the purpose of enabling different execution flows.

https://github.com/sankalpjonn/timeloop/blob/master/timeloop/app.py#L38-L41 https://github.com/sankalpjonn/timeloop/blob/master/timeloop/app.py#L64-L65