----- Original Message ----- > From: "Cyril Hrubis" <chru...@suse.cz> > To: "Jan Stancek" <jstan...@redhat.com> > Cc: ltp-list@lists.sourceforge.net > Sent: Thursday, 16 October, 2014 3:01:28 PM > Subject: Re: [LTP] [PATCH] doc: document tst_checkpoint_create and > tst_checkpoint_init > > We should also add: > > IMPORTANT: Be wary that using single checkpoint to signal child/parent > followed > immediately by wait for parent/child creates an race condtion > between opening the pipe and reading from it (the process > writing to the fifo may may be the wery same process that > reads from it and the checkpoint code will exit the test > with error). You are advised to use two checkpoints in this > case. >
I thought we had this issue only in parent: --------------------------------------------------------------------------------------------------- parent | child | tst_checkpoint_child_wait | - has to wait until parent opens pipe for write tst_checkpoint_signal_child (NONBLOCK write) | tst_checkpoint_parent_wait (NONBLOCK read) | - parent now races on read with child | --------------------------------------------------------------------------------------------------- because child is opening always in blocking mode, it will always wait until other side is opened as well: --------------------------------------------------------------------------------------------------- parent | child | tst_checkpoint_signal_parent | - has to wait until parent opens pipe for read tst_checkpoint_parent_wait (NONBLOCK read) | - reads from FIFO | | tst_checkpoint_child_wait | - has to wait until parent opens pipe for write tst_checkpoint_signal_child (NONBLOCK write) | - at this point first byte was already read | from FIFO, parent writes second byte | | - and only now will child succeed opening pipe --------------------------------------------------------------------------------------------------- Am I missing something? Regards, Jan > -- > Cyril Hrubis > chru...@suse.cz > ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list