Welcome! Log In Create A New Profile

Advanced

Asynchronous Handler & Callbacks

Daniel Eggert
November 21, 2017 03:52PM
I'm writing my own Module and Handler for nginx, but I can't figure out how to do asynchronous work.


From my handler, I'm calling an existing library, that'll run a callback on a thread of its own when it is done.

I can't figure out how to switch back to the nginx event loop thread.


It seems like it's ok for me to run

r->blocked++;
return NGX_AGAIN;

inside my callback handler the first time it's called, but once the "external" callback runs, it'd need to tell nginx to run my handler again. I'm assuming that I'd do that my posting an event to the request's event loop and then call

ngx_http_core_run_phases(r)

on the request. But I'm a bit lost as to whether that's the right approach.

Thanks in advance.

/Daniel

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Asynchronous Handler & Callbacks

Daniel Eggert 413 November 21, 2017 03:52PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 310
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready