#include <errno.h>#include <pthread.h>#include <signal.h>#include <stdatomic.h>#include <string.h>#include <time.h>#include <atalk/logger.h>#include <atalk/queue.h>#include "dircache.h"#include "directory.h"#include "idle_worker.h"Macros | |
| #define | IDLE_WORKER_WAKE_MS 10 |
Functions | |
| static int | idle_worker_has_work (void) |
| Check if any idle work is pending (work-availability predicate). | |
| static void * | idle_worker_main (void *arg) |
| Worker thread main loop. | |
| int | idle_worker_init (void) |
| void | idle_worker_start (void) |
| void | idle_worker_stop (void) |
| void | idle_worker_stop_signal_safe (void) |
| void | idle_worker_shutdown (void) |
| int | idle_worker_is_active (void) |
| void | idle_worker_log_stats (void) |
Variables | |
| static atomic_int | is_idle = 0 |
| static atomic_int | bg_running = 0 |
| static atomic_int | shutdown_flag = 0 |
| static pthread_t | worker_tid |
| static int | worker_started = 0 |
| struct { | |
| unsigned int cycles_started | |
| unsigned int cycles_completed | |
| unsigned int cycles_interrupted | |
| } | worker_stat |
| #define IDLE_WORKER_WAKE_MS 10 |
|
static |
Check if any idle work is pending (work-availability predicate).
This function serves two purposes:
| int idle_worker_init | ( | void | ) |
| int idle_worker_is_active | ( | void | ) |
| void idle_worker_log_stats | ( | void | ) |
|
static |
Worker thread main loop.
Uses nanosleep() for 10ms polling which is a direct SYS_nanosleep syscall
| void idle_worker_shutdown | ( | void | ) |
| void idle_worker_start | ( | void | ) |
| void idle_worker_stop | ( | void | ) |
| void idle_worker_stop_signal_safe | ( | void | ) |
|
static |
| unsigned int cycles_completed |
| unsigned int cycles_interrupted |
| unsigned int cycles_started |
|
static |
|
static |
|
static |
| struct { ... } worker_stat |
|
static |