class
ion7.core.Threadpool
Functions
Threadpool.new
Create a CPU threadpool with `n_threads` worker threads.
raises — When `n_threads` is invalid or `ggml_threadpool_new` fails.
Threadpool:ptr
Return the raw `ggml_threadpool_t` cdata pointer for use with `Context:attach_threadpool` (or any other ggml API that wants one).
Threadpool:n_threads
Return the cached worker count. Cheap : avoids the FFI roundtrip of `ggml_threadpool_get_n_threads`. The value never changes after construction so caching is exact.
Threadpool:pause
Pause every worker thread. Workers stop accepting new jobs until `resume` is called. No-op when the pool is already freed.
Threadpool:resume
Resume previously paused workers. No-op when the pool is freed.
Threadpool:free
Manually release the threadpool's native resources. Idempotent — safe to call multiple times. The `ffi.gc` finalizer is disarmed BEFORE the explicit free so the GC does not double-free the same pointer later.