mirror of
https://github.com/koush/scrypted.git
synced 2026-02-08 16:29:57 +00:00
10 lines
351 B
Python
10 lines
351 B
Python
import asyncio
|
|
import concurrent.futures
|
|
|
|
# vips is already multithreaded, but needs to be kicked off the python asyncio thread.
|
|
toThreadExecutor = concurrent.futures.ThreadPoolExecutor(max_workers=2, thread_name_prefix="image")
|
|
|
|
async def to_thread(f):
|
|
loop = asyncio.get_running_loop()
|
|
return await loop.run_in_executor(toThreadExecutor, f)
|