I have an application in C++ we originally made for Windows using
Microsoft’s http lib, that I have ported to be cross-platform using
nginx.
To keep it working mostly the same (rewriting as little as possible), I
made
it as a lib that gets loaded by a module I made for nginx that
communicates
with it via a C interface with simple functions (startup, shutdown,
callEndpoint). It works for any calls that don’t depend on threads, but
anything that depends on the worker threads that we create (not using
nginx’s apis) doesn’t work. When I attach to either of the nginx
processes
with gdb and do info threads
, I only see one thread each.
I set our function that loads the lib, then calls startup(), which
launches
these worker threads, as the “init module” function. The handle for the
lib
remains so many of the calls work just fine. But the threads are gone,
so
anything that depends on these worker threads doesn’t function (it
freezes
actually). Is there a way to let my module start threads without having
to
use nginx’s api or otherwise drastically change my architecture?
Posted at Nginx Forum: