Repository navigation
API Background tasks
Alexandre 'kidev' Poumaroux edited this page Oct 21, 2026
·
4 revisions
| Import | from proleak import tasks |
Background work that never blocks the game.
| Returns | Function | |
|---|---|---|
concurrent.futures.Future |
run_in_thread(fn: Callable, *args, **kwargs) |
Run fn(*args, **kwargs) on a worker thread; returns a concurrent.futures.Future. |
None |
call_soon_main(fn: Callable, *args) |
Queue fn(*args) for the game's main thread at the next frame. |
concurrent.futures.Future |
spawn(coro: Coroutine) |
Run a coroutine on ProLeak's shared asyncio loop; returns a concurrent.futures.Future. |
| Type | Value | |
|---|---|---|
asyncio.AbstractEventLoop |
loop read-only
|
ProLeak's shared asyncio loop, which spawn runs on. |
run_in_thread(fn: Callable, *args, **kwargs) -> concurrent.futures.Future
Run fn(*args, **kwargs) on a worker thread; returns a concurrent.futures.Future.
Pending work is cancelled when the plugin unloads, and running work receives
PluginUnloaded. Game objects are not safe here; hand results back with
call_soon_main.
call_soon_main(fn: Callable, *args) -> None
Queue fn(*args) for the game's main thread at the next frame. Safe from any thread.
spawn(coro: Coroutine) -> concurrent.futures.Future
Run a coroutine on ProLeak's shared asyncio loop; returns a concurrent.futures.Future.
The task is cancelled when the plugin unloads.
loop: asyncio.AbstractEventLoop [read-only]
ProLeak's shared asyncio loop, which spawn runs on. It runs on its own thread.
Using ProLeak
Features
Tutorial
- Your first plugin
- Plugin basics
- Handling events
- Plugin settings
- User interface
- Players, units and game data
- Purchases, signals and pings
- Chat, camera, input and more
- Cosmetics
- Game modes
- Game updates
- Publishing plugins
Reference