mirror of
https://github.com/lammertb/libhttp.git
synced 2025-08-09 03:22:45 +03:00
Merge pull request #304 from jdetaeye/master
Adding a callback that is called when a new worker thread is initialized
This commit is contained in:
@@ -206,6 +206,12 @@ struct mg_callbacks {
|
||||
ctx: context handle */
|
||||
void (*init_context)(const struct mg_context *ctx);
|
||||
|
||||
/* Called when a new worker thread is initialized.
|
||||
Parameters:
|
||||
ctx: context handle
|
||||
thread_type: a value of 1 indicates a worker thread. */
|
||||
void(*init_thread)(const struct mg_context *ctx, int thread_type);
|
||||
|
||||
/* Called when civetweb context is deleted.
|
||||
Parameters:
|
||||
ctx: context handle */
|
||||
|
@@ -12299,6 +12299,10 @@ worker_thread_run(void *thread_func_param)
|
||||
tls.pthread_cond_helper_mutex = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
#endif
|
||||
|
||||
if (ctx->callbacks.init_thread) {
|
||||
ctx->callbacks.init_thread(ctx, 1);
|
||||
}
|
||||
|
||||
conn =
|
||||
(struct mg_connection *)mg_calloc(1, sizeof(*conn) + MAX_REQUEST_SIZE);
|
||||
if (conn == NULL) {
|
||||
|
Reference in New Issue
Block a user