mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-28 13:09:11 -05:00
[httpd] Multithread solution using worker threads instead of httpd threads
Using worker threads instead of httpd threads means that we, not libevent, decide which requests get handled by which threads. This means that we can make sure blocking requests (e.g. volume changes) don't get in the way of realtime(ish) stuff like mp3 streaming. Includes refactor of httpd_stream_file() since it was a bit of a monster.
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
#ifndef __WORKER_H__
|
||||
#define __WORKER_H__
|
||||
|
||||
#include <event2/event.h>
|
||||
|
||||
/* The worker thread is made for running asyncronous tasks from a real time
|
||||
* thread, mainly the player thread.
|
||||
* thread.
|
||||
|
||||
* The worker_execute() function will trigger a callback from the worker thread.
|
||||
* Before returning the function will copy the argument given, so the caller
|
||||
@@ -19,6 +21,11 @@
|
||||
void
|
||||
worker_execute(void (*cb)(void *), void *cb_arg, size_t arg_size, int delay);
|
||||
|
||||
/* Can be called within a callback to get the worker thread's event base
|
||||
*/
|
||||
struct event_base *
|
||||
worker_evbase_get(void);
|
||||
|
||||
int
|
||||
worker_init(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user