Welcome! Log In Create A New Profile

Advanced

Fwd: busywaiting without blocking event loop OR timers

fin
August 29, 2011 09:36AM
hello everyone,

[this is a crosspost from nginx-devel, which seems awful quiet these days …]

i'm working on a module that uses ngx_event_connect to connect to a
3rdparty service and parses its request.
the answer depends on the request hostname, so now i'm implementing a
cache in shared memory to cache the responses on a hostname basis.

i'm protecting access to every cache entry using a ngx_atomic_t.

now i'd like to prevent multiple concurrent connections from requests
to the same hostname to the 3rd party service.

i see two ways to solve that:
* busy-wait on ngx_atomic_t as long as a request to the service is open
* create an event and wait for it

now, how can i busy-wait on a ngx_atomic_t without blocking the
handling of other requests in the same process?
(these requests can last up to 10 seconds in worst-case)
-> can i yield to the event loop while busy-waiting?

can i create events independent of I/O, like timer events?

thanks in advance
-fin

PS:
our howto on doing what we're doing in our module:
http://blog.efficientcloud.com/2011/08/24/nginx-upstream/

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

Fwd: busywaiting without blocking event loop OR timers

fin August 29, 2011 09:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 344
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