mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-28 05:04:16 -05:00
[evhtr] Consolidate pool threading in evthr.c
Also reinstate check for server already running
This commit is contained in:
43
src/evthr.h
Normal file
43
src/evthr.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef __EVTHR_H__
|
||||
#define __EVTHR_H__
|
||||
|
||||
enum evthr_res {
|
||||
EVTHR_RES_OK = 0,
|
||||
EVTHR_RES_BACKLOG,
|
||||
EVTHR_RES_RETRY,
|
||||
EVTHR_RES_NOCB,
|
||||
EVTHR_RES_FATAL
|
||||
};
|
||||
|
||||
struct evthr_pool;
|
||||
struct evthr;
|
||||
|
||||
typedef void (*evthr_cb)(struct evthr *thr, void *cmd_arg, void *shared);
|
||||
typedef void (*evthr_init_cb)(struct evthr *thr, void *shared);
|
||||
typedef void (*evthr_exit_cb)(struct evthr *thr, void *shared);
|
||||
|
||||
struct event_base *
|
||||
evthr_get_base(struct evthr *thr);
|
||||
|
||||
void
|
||||
evthr_set_aux(struct evthr *thr, void *aux);
|
||||
|
||||
void *
|
||||
evthr_get_aux(struct evthr *thr);
|
||||
|
||||
enum evthr_res
|
||||
evthr_pool_defer(struct evthr_pool *pool, evthr_cb cb, void *arg);
|
||||
|
||||
struct evthr_pool *
|
||||
evthr_pool_wexit_new(int nthreads, evthr_init_cb init_cb, evthr_exit_cb exit_cb, void *shared);
|
||||
|
||||
void
|
||||
evthr_pool_free(struct evthr_pool *pool);
|
||||
|
||||
enum evthr_res
|
||||
evthr_pool_stop(struct evthr_pool *pool);
|
||||
|
||||
int
|
||||
evthr_pool_start(struct evthr_pool *pool);
|
||||
|
||||
#endif /* !__EVTHR_H__ */
|
||||
Reference in New Issue
Block a user