include/razorback/thread_pool.h File Reference
Thread worker pool API.
More...
#include <razorback/visibility.h>
#include <razorback/types.h>
#include <razorback/api.h>
#include <razorback/list.h>
Go to the source code of this file.
Detailed Description
Thread worker pool API.
Function Documentation
SO_PUBLIC struct ThreadPool* ThreadPool_Create |
( |
int |
initialThreads, |
|
|
int |
maxThreads, |
|
|
struct RazorbackContext * |
context, |
|
|
const char * |
namePattern, |
|
|
void(*)(struct Thread *) |
mainFunction | |
|
) |
| | [read] |
Create a ThreadPool.
- Parameters:
-
| intialThread | The number of threads to launch on creation. |
| maxThreads | The maximum number of workers allowed in the pool. |
| context | The context of the worker threads. |
| namePattern | The printf pattern for the worker thread names, must contain d |
| mainFunction | The main routine for the threads. |
- Returns:
- A new ThreadPool or NULL on error.
SO_PUBLIC bool ThreadPool_KillWorker |
( |
struct ThreadPool * |
pool, |
|
|
int |
id | |
|
) |
| | |
Kill a worker.
- Parameters:
-
| pool | The ThreadPool to which the worker belongs. |
| id | The workers id. |
- Returns:
- true on success, false on error.
SO_PUBLIC bool ThreadPool_KillWorkers |
( |
struct ThreadPool * |
pool |
) |
|
Kill all workers.
- Parameters:
-
- Returns:
- true on success, false on error
SO_PUBLIC bool ThreadPool_LaunchWorker |
( |
struct ThreadPool * |
pool |
) |
|
Launch a worker.
- Parameters:
-
- Returns:
- true on success, false on error.
SO_PUBLIC bool ThreadPool_LaunchWorkers |
( |
struct ThreadPool * |
pool, |
|
|
int |
count | |
|
) |
| | |
Launch several workers.
- Parameters:
-
| pool | The ThreadPool to spawn the workers in. |
| count | The number of workers to spawn. |
- Returns:
- true on success, false on error.