[Ace-users] [ace-users] ACE_Event_Handler :: handle_output() humble question

Steve Huston shuston at riverace.com
Sat Oct 27 14:22:56 CDT 2007


Hi Pavel,

> Hi folks! I'm new to this list and first of all I'd like to thank
all
> ACE developers for their hard work.

Welcome! In the future, please use the PROBLEM-REPORT-FORM in the
ACE_wrappers directory to supply all needed information when asking
questions.

> Probably this list is not a proper place for such question(please
tell
> me if so) but I had no idea where to ask.

This is a good place.

> In short, I have the ClientAcceptor and ClientHandler classes
derived
> from ACE_Event_Handler and registered in reactor: ClientAcceptor
> accepts new connections, creates ClientHandler and registers it in
> reactor too.

Ok, good.

> ClientHandler class has handle_input(..) overridden and in this
method
> it extracts message objects from the socket and puts them into the
> input queue. This part works just fine ;)

Good.

> Each ClientHandler also has its own output queue of messages. This
> queue is filled by some application logic which processes input
> messages and reacts to them.

Ok.

> The question is what is the best way to send notification to each
> ClientHandler to send a portion of its output messages in the queue?
> Is it ok to use handle_output() for very this purpose?
> 
> Am I right in my thinking this is the proper way to trigger each
> ClientsHandler's handle_input(..)?
> 
>  for(;;)
>  {
>     reactor->handle_events();
>     reactor->notify(NULL, ACE_Event_Handler::WRITE_MASK);
>  }
> 
> Maybe this problem has a more elegant solution I'm not aware of,
> please tell me ;)

You didn't say if you are using ACE_Message_Queue for the queue, but I
recommend you look at integrating notifications with the queue. Please
see section 7.6.3 in APG, or sidebar 38 on page 163 in C++NPv2. For
more information on these books, please see
http://www.riverace.com/acebooks/index.htm.

Best regards,
-Steve

--
Steve Huston, Riverace Corporation
Would you like ACE to run great on your platform?
See http://www.riverace.com/sponsor.htm




More information about the Ace-users mailing list