[Ace-users] [ace-users] RE : RE : RE : RE : Notify in handle_signal
ext.zxerasoge002 at astrium.eads.net
Tue Feb 12 10:54:57 CST 2008
I am in the particular case of a signal handling, so things are a easier
since it can't be interrupted. Inside handle_signal, I could check if
the pipe is empty and the state won't change as long as I don't write
In fact, correct me if I'm wrong, but in my understanding signal
handling causes all threads to be stopped as long as the handling is not
done, even on a multi cpu. I'm talking about Linux on x86 architecture,
maybe this is completely wrong on other plateforms. At least this is
true if the application has only one thread since I experienced this
deadlock (handle_signal is blocked in the write on the notification
pipe, and the reactor that read from the pipe is paused as long as the
signal handling is not terminated).
I could have inherited from Select_Reactor_T to have this
notification_pipe_empty() method, and it would have done the work I
guess, I didn't think about that.
Actually we found a way to call notify only when needed with a counter
which is incremented in handle_signal and decremented in
handle_exception. It's not exactly trivial since handle_exception can be
interrupted by handle_signal, and mutexes are prohibited here, but it's
feasable if one is careful about when the operations are done.
From: ace-users-bounces at cse.wustl.edu
[mailto:ace-users-bounces at cse.wustl.edu] On Behalf Of Chris Cleeland
Sent: Tuesday, February 12, 2008 5:17 PM
To: ace-users at cse.wustl.edu
Subject: Re: [ace-users] RE : RE : RE : Notify in handle_signal
On Feb 12, 2008, at 7:46 AM, ZXERASOGE002, Ext wrote:
> In my case I don't care if I miss a few notifications when the pipe is
> not empty because I have a loop over waitpid in handle_exception.
> But in
> handle_signal I must be sure I call notify when the pipe is empty. One
> solution would be to check in handle_signal if there is something to
> read from the notification pipe (with a select for instance), and call
> notify *only* when there is nothing to read (ie the pipe is empty).
> problem is the notification_pipe is protected and not public
Don't you still have a race condition where the pipe fills between the
time you check for empty and the time you actually try to write? I
realize that's pathological and fairly unlikely, but it doesn't sound
As far as gaining access to the notification_pipe, it's been awhile
since I've mucked around with reactor internals, but couldn't you
specialize the implementation (Select_Reactor or Select_Reactor_T) and
override notify() with your own implementation that does what you want?
Chris Cleeland, Principal Software Engineer
http://www.theaceorb.com AND http://www.ociweb.com
ace-users mailing list
ace-users at mail.cse.wustl.edu
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
More information about the Ace-users