|
/*
|
|
* DWN - Desktop Window Manager
|
|
* retoor <retoor@molodetz.nl>
|
|
* Threading Integration Header
|
|
*/
|
|
|
|
#ifndef DWN_THREADING_INTEGRATION_H
|
|
#define DWN_THREADING_INTEGRATION_H
|
|
|
|
#include "threading.h"
|
|
#include "thread_workers.h"
|
|
#include <sys/select.h>
|
|
|
|
/**
|
|
* Initialize threading integration with main loop
|
|
*/
|
|
bool threading_integration_init(void);
|
|
|
|
/**
|
|
* Shutdown threading integration
|
|
*/
|
|
void threading_integration_shutdown(void);
|
|
|
|
/**
|
|
* Prepare fd_set for select() - adds threading fds
|
|
*/
|
|
void threading_integration_prepare_select(int xfd, fd_set *fds, int *max_fd);
|
|
|
|
/**
|
|
* Process threading events after select() returns
|
|
*/
|
|
void threading_integration_process(fd_set *fds);
|
|
|
|
/**
|
|
* Non-blocking poll for async work
|
|
*/
|
|
void threading_integration_poll(void);
|
|
|
|
/**
|
|
* Run one iteration with integrated threading
|
|
*/
|
|
void threading_integration_run_iteration(int xfd, void (*handle_xevent)(void));
|
|
|
|
/**
|
|
* Get stats string for display
|
|
*/
|
|
void threading_integration_get_stats(char *buf, size_t bufsize);
|
|
|
|
/**
|
|
* Initialize per-module async contexts
|
|
*/
|
|
bool threading_integration_init_module_contexts(void);
|
|
|
|
/**
|
|
* Cleanup per-module async contexts
|
|
*/
|
|
void threading_integration_cleanup_module_contexts(void);
|
|
|
|
/**
|
|
* Get module-specific async contexts
|
|
*/
|
|
AsyncContext* threading_integration_get_ai_context(void);
|
|
AsyncContext* threading_integration_get_screenshot_context(void);
|
|
AsyncContext* threading_integration_get_ocr_context(void);
|
|
|
|
/**
|
|
* High-level task submission
|
|
*/
|
|
TaskHandle threading_integration_submit_ai(TaskFunc func, void *user_data);
|
|
TaskHandle threading_integration_submit_screenshot(TaskFunc func, void *user_data);
|
|
TaskHandle threading_integration_submit_ocr(TaskFunc func, void *user_data);
|
|
TaskHandle threading_integration_submit_ui(TaskFunc func, void *user_data);
|
|
TaskHandle threading_integration_submit_background(TaskFunc func, void *user_data);
|
|
|
|
#endif /* DWN_THREADING_INTEGRATION_H */
|