[Ace-users] [ace-users] RE : Notify in handle_signal
Douglas C. Schmidt
schmidt at dre.vanderbilt.edu
Tue Feb 12 07:48:44 CST 2008
> Does anyone agree/disagree there is an issue here ?
> I would really appreciate your help about this.
Ways to address this situation are covered in Chapters 3 and 4 of
C++NPv2 <www.cs.wustl.edu/~schmidt/ACE/book2/>. I'll let Steve
H. address it in the context of the APG example.
> Philippe David
> -----Original Message-----
> From: ZXERASOGE002, Ext
> Sent: Friday, February 08, 2008 11:42 AM
> To: ace-users at cse.wustl.edu
> Subject: Notify in handle_signal
> I have a question relative to the sample code in section 7.4 of
> the ACE programmer's guide p158.
> In a handle_signal callback, there is the following code:
> ACE_Reactor::instance ()->notify(this)
> There is a potential deadlock here. If for some reason the
> process receives a lot of signals, and you don't process the
> notifications quickly enough, the pipe can be full. Since this call is
> blocking, and you are processing a signal, there is no chance your
> process will unlock from this situation.
> What is the best way to solve this ? Making a blocking call in
> handle_signal looks like a mistake to me.
> In the case of notify, if the pipe is full there's is no need to
> wait, it will stay in this state as long as we are in handle_signal. I
> see that we can add a timeout to the notify call, so at least it won't
> wait forever. But as I said, if the pipe is full there is no need to
> wait, so what is the best value for this timeout ? 1ms ? Are we 100%
> sure this low value won't skip a write when the pipe is not full ?
> Still, it means that every signal received when the pipe is full
> will lock the process for 1ms, so we are slowing down the process
> exactly when it is not fast enough to handle all the signals received.
> Plus each handle_signal will be 1ms long, which is too much.
> So is there a way to make a non blocking call in the notify ? or
> a way to know if the pipe is full before trying to make a write on the
> pipe ?
> Philippe David
> SOGETI High Tech
> Ce courriel (incluant ses eventuelles pieces jointes) peut contenir des informations confidentielles et/ou protegees ou dont la diffusion est restreinte. Si vous avez recu ce courriel par erreur, vous ne devez ni le copier, ni l'utiliser, ni en divulguer le contenu a quiconque. Merci d'en avertir immediatement l'expediteur et d'effacer ce courriel de votre systeme. Astrium decline toute responsabilite en cas de corruption par virus, d'alteration ou de falsification de ce courriel lors de sa transmission par voie electronique.
> This email (including any attachments) may contain confidential and/or privileged information or information otherwise protected from disclosure. If you are not the intended recipient, please notify the sender immediately, do not copy this message or any attachments and do not use it for any purpose or disclose its content to any person, but delete this message and any attachments from your system. Astrium disclaims any and all liability if this email transmission was virus corrupted, altered or falsified.
> Astrium SAS (393 341 516 RCS Paris) - Siege social: 6 rue Laurent Pichat, 75016 Paris, France
> ace-users mailing list
> ace-users at mail.cse.wustl.edu
More information about the Ace-users