Welcome! Log In Create A New Profile

Advanced

pthread in nginx module

March 09, 2021 01:00AM
Hi Everyone,

I am developing an nginx module.
The module requires some background processing via thread when the server is running.

I have written my module to use pthread.h
I have attempted to spawn a thread during the init_module function (specified in ngx_module_t of the module)
Unfortunately this thread is terminated after the init_module function is done. I need the thread to continue running indefinitely.

I have also tried to create a thread during the init_process function, which also fails.

nginx is compiled with threadpool and fileio support.

Is it possible to have my module use pthread.h and run pthead_create() to have create threads during the execution of nginx, which stay alive throught the life of the program?
My attempts all failed as soon as the module return execution the nginx, the threads are terminated.

Thanks.
Subject Author Posted

pthread in nginx module

klowd92 March 09, 2021 01:00AM

Re: pthread in nginx module

Maxim Dounin March 09, 2021 08:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 54
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready