def from_thread(func, *args, **kwargs): call = lambda: deferToThread(func, *args, **kwargs) return cpu_core_semaphore.run(call)