lib/tst_checkpoint.c: added support for unlimited number of named pipes
Now both child and parent can wait for each other which was not
possible using only one named pipe as it would cause race condition.
Example of race condition which can be resolved by using
two checkpoints instead of one (following is parent code):
TST_CHECKPOINT_SIGNAL_CHILD(cleanup, &checkpoint);
/* child now doing some action on which parent must wait to finish */
TST_CHECKPOINT_PARENT_WAIT(cleanup, &checkpoint);
The problem here is that PARENT_WAIT() is usually executed
immediately after SIGNAL_CHILD() which causes:
1) "Wrong data read from the pipe at ..." error message
2) that inside child, the call of CHILD_WAIT() hangs, because read
was done from parent (by PARENT_WAIT() call)
Signed-off-by: Matus Marhefka <mmarhefk@redhat.com>
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
2 files changed