All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Wei Yongjun <yjwei@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] Synchronization between two processes
Date: Mon, 25 May 2009 17:16:09 -0500	[thread overview]
Message-ID: <20090525221609.GA30283@us.ibm.com> (raw)
In-Reply-To: <4A163E59.7030002@cn.fujitsu.com>

Quoting Wei Yongjun (yjwei@cn.fujitsu.com):
> Serge E. Hallyn wrote:
>> Quoting Subrata Modak (subrata@linux.vnet.ibm.com):
>>   
>>> On Fri, 2009-05-15 at 08:45 -0500, Serge E. Hallyn wrote:     
>>>> Quoting Gui Xiaohua (guixh@cn.fujitsu.com):
>>>>       
>>>>> The child-process wait SIGUSR1 which would be sended by parent-process,
>>>>> if the child-process execute sigtimedwait() after parent-process 
>>>>> send the signal, it would never receive the SIGUSR1 from 
>>>>> parent-process.
>>>>> I cann't make sure the SIGUSR1 be sended after child-process 
>>>>> execute sigtimedwait() with 100 percent, and i try my best.
>>>>>         
>>>> Well, in theory I suppose this could happen, but you'd have to have
>>>> a pretty bad scheduler if the parent can do a strcmp(buf, "c:go")
>>>> between the pipe read and signal send, while the child goes straight
>>>> from pipe write to sigtimedwait.
>>>>
>>>> Have you seen this signal be missed?  If not, then I'd rather assume
>>>> things are reasonable.  If you have seen this happen, then why not
>>>> instead set up a SIGUSR1 handler in the child before doing the pipe
>>>> write, then just sleep for 3 seconds instead of doing sigtimedwait?
>>>>       
>>> Thanks Serge.
>>>     
>>
>> Or, if I'm being unreasonable, then at least have the parent only wait
>> for at most 1 second, and leave the child alone.  Every every ltp test
>> is going to hang for 5 seconds...
>>
>> But I prefer setting the signal handler ahead of time.
>>
>>   
> Sorry to relpy late.
>
> As your last advice, i change the test case, and it work will.
>
> [PATCH] fix sync problem between two processes of pidns12 test
>
> The child-process wait SIGUSR1 which would be sended by parent-process,
> if the child-process execute sigtimedwait() after parent-process send
> the signal, it would never receive the SIGUSR1 from parent-process.
>
> This patch rewrite child_signal_handler() to handle to SIGUSR1 and
> instead sigtimedwait() with sleep for 3 seconds.

Thank you, this looks right.

I assume the reason it wasn't originally done this way, was out of
a concern that the TPASS/TFAIL out of signal handler wouldn't
count...

-serge

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

      parent reply	other threads:[~2009-05-25 22:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-15  7:04 [LTP] [PATCH] Synchronization between two processes Gui Xiaohua
2009-05-15  8:41 ` Subrata Modak
2009-05-15 13:45 ` Serge E. Hallyn
2009-05-18 11:59   ` Subrata Modak
2009-05-18 15:07     ` Serge E. Hallyn
2009-05-22  5:55       ` Wei Yongjun
2009-05-25 16:13         ` Subrata Modak
2009-05-25 22:17           ` Serge E. Hallyn
2009-05-26 12:22             ` Subrata Modak
2009-05-25 22:16         ` Serge E. Hallyn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090525221609.GA30283@us.ibm.com \
    --to=serue@us.ibm.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=yjwei@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.