Daemons
include/thread/daemon.h View source View on GitHubStructs
Section titled “Structs”daemon_thread
Section titled “daemon_thread” struct daemon_thread (6 fields) source
daemon_work
Section titled “daemon_work” struct daemon_work (4 fields) source
daemon_attributes
Section titled “daemon_attributes” struct daemon_attributes (7 fields) source
§
size_t max_timesharing_threads §
size_t min_timesharing_threads §
atomic_size_t timesharing_threads Internal
§
atomic_size_t idle_timesharing_threads Internal
§
atomic_bool background_thread_present Internal
§
enum daemon_flags flags daemon
Section titled “daemon” struct daemon (12 fields) source
§
char *name §
struct daemon_work *timesharing_work §
struct daemon_thread *background_thread §
struct daemon_work *background_work §
struct daemon_attributes attrs §
refcount_t refcount §
atomic(enum daemon_state) state daemon_thread_command
Section titled “daemon_thread_command” enum daemon_thread_command (5 variants) source
These commands are sent back up to the daemon thread executing a daemon work and are operated upon the completion of the daemon work
§
DAEMON_THREAD_COMMAND_NONE §
DAEMON_THREAD_COMMAND_EXIT Daemon thread exit
§
DAEMON_THREAD_COMMAND_RESTART Restart the function
§
DAEMON_THREAD_COMMAND_SLEEP Go to sleep
§
DAEMON_THREAD_COMMAND_DEFAULT = DAEMON_THREAD_COMMAND_SLEEP daemon_flags
Section titled “daemon_flags” enum daemon_flags (5 variants) source
daemon_state
Section titled “daemon_state” enum daemon_state (3 variants) source
Type Aliases
Section titled “Type Aliases”daemon_fn
Section titled “daemon_fn”typedef enum daemon_thread_command (*daemon_fn)(
void * arg,
void * arg2
) source Functions
Section titled “Functions”daemon_state_str
Section titled “daemon_state_str”const char * daemon_state_str(enum daemon_state s) source daemon_create_full
Section titled “daemon_create_full”struct daemon * daemon_create_full(
struct daemon_attributes *attrs,
struct daemon_work *timesharing_work,
struct daemon_work *background_work,
struct workqueue_attributes *wq_attrs,
const char *fmt
) source daemon_destroy
Section titled “daemon_destroy”daemon_spawn_worker
Section titled “daemon_spawn_worker”struct daemon_thread * daemon_spawn_worker(struct daemon *daemon) source daemon_submit_oneshot_work
Section titled “daemon_submit_oneshot_work”enum workqueue_error daemon_submit_oneshot_work(
struct daemon *daemon,
work_function func,
struct work_args args
) source daemon_submit_work
Section titled “daemon_submit_work”daemon_print
Section titled “daemon_print”daemon_wake_background_worker
Section titled “daemon_wake_background_worker”daemon_wake_timesharing_worker
Section titled “daemon_wake_timesharing_worker”daemon_wake_all_idle_timesharing_workers
Section titled “daemon_wake_all_idle_timesharing_workers”Macros
Section titled “Macros”DAEMON_WORK_FROM
Section titled “DAEMON_WORK_FROM”#define DAEMON_WORK_FROM(fn, a) source Expansion
#define DAEMON_WORK_FROM(fn, a) \
((struct daemon_work) {.function = fn, .args = a}) daemon_thread_from_list_node
Section titled “daemon_thread_from_list_node”#define daemon_thread_from_list_node(ln) source Expansion
#define daemon_thread_from_list_node(ln) \
container_of(ln, struct daemon_thread, list_node) daemon_create
Section titled “daemon_create”#define daemon_create(name, attrs, timesharing_work, background_work, \ wq_attrs) source Expansion
#define daemon_create(name, attrs, timesharing_work, background_work, \
wq_attrs) \
daemon_create_full((attrs), (timesharing_work), (background_work), \
(wq_attrs), PP_UNPAREN(name)) DAEMON_FLAG_TEST
Section titled “DAEMON_FLAG_TEST”Expansion
#define DAEMON_FLAG_TEST(daemon, flag) (daemon->attrs.flags & flag)