How can a content handler block on certain events before sending a response?

Hongli Lai lists at ruby-forum.com
Wed Nov 24 02:43:46 MSK 2010


Maxim Dounin wrote in post #963250:
> Working with events isn't something trivial, but basically you'll
> have to connect via ngx_event_connect_peer(), set up appropriate
> read/write handlers in resulting connection structure and call
> ngx_handle_(read|write)_event() as appropriate.

I need to use ngx_add_event for registering a read/write watcher, right? 
So I need to allocate an ngx_event_s struct, set its 'handler' member to 
my handler function, and call ngx_add_event(&evt, NGX_READ_EVENT, 0)? Do 
I need to set any other members for it to work? Do I need to zero the 
structure if I don't set anything else?

What are appropriate times to call ngx_handle_read/write_event? What do 
those functions do? Isn't the main loop supposed to call event handler 
functions for me?

-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list