kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 9abf15a4980ad7d270417cd4715243fe99d9e1b5
parent 39a5f219862d1d6934bc4488fa9d9b9f03f4db09
Author: Joris Vink <joris@coders.se>
Date:   Wed,  6 Jul 2016 21:59:17 +0200

Make kore_onload() to be done per worker.

Mimics the behaviour of dso builds.

Diffstat:
src/kore.c | 6------
src/worker.c | 10++++++++++
2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/kore.c b/src/kore.c @@ -117,9 +117,6 @@ int main(int argc, char *argv[]) { int ch, flags; -#if defined(KORE_SINGLE_BINARY) - void (*kmain)(void); -#endif flags = 0; @@ -191,9 +188,6 @@ main(int argc, char *argv[]) usage(); #else kore_module_load(NULL, NULL); - *(void **)&(kmain) = kore_module_getsym("kore_main"); - if (kmain != NULL) - kmain(); #endif kore_parse_config(); diff --git a/src/worker.c b/src/worker.c @@ -266,6 +266,9 @@ kore_worker_entry(struct kore_worker *kw) char buf[16]; int quit, had_lock, r; u_int64_t now, idle_check, next_lock, netwait; +#if defined(KORE_SINGLE_BINARY) + void (*onload)(void); +#endif worker = kw; @@ -327,7 +330,14 @@ kore_worker_entry(struct kore_worker *kw) #endif kore_log(LOG_NOTICE, "worker %d started (cpu#%d)", kw->id, kw->cpu); + +#if defined(KORE_SINGLE_BINARY) + *(void **)&(onload) = kore_module_getsym("kore_onload"); + if (onload != NULL) + onload(); +#else kore_module_onload(); +#endif for (;;) { if (sig_recv != 0) {