engine.c
Source file: engine.c
Function: engine_run
int engine_run(const struct engine_config *cfg)
Example
struct engine_config cfg = { .max_threads = 4, .debug = 0 };
engine_init(0);
int rc = engine_run(&cfg);
engine_shutdown();Run the main engine loop.
Call engine_init before this. Uses engine_config.max_threads
to decide how many workers to spawn.
Returns: Exit code.
Parameters:
| Name | Type | Description |
|---|---|---|
cfg |
const struct engine_config * |
Pointer to engine_config. |
Returns: int
Appendix
Example usage in code
engine_test.c:17
static void test_debug_mode(void)
{
struct engine_config cfg = {
.max_threads = 2,
.debug = 1,
};
engine_init(ENGINE_DEBUG);
engine_run(&cfg);
engine_shutdown();
}