<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Richard, Edward,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 11, 2022 at 4:33 PM Richard Palethorpe <<a href="mailto:rpalethorpe@suse.de">rpalethorpe@suse.de</a>> wrote:<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> Looking at tst_fzsync_run_a, if anything goes wrong in other places<br>
> (thread_b) and break with setting 'pair->exit' to 1 to end the looping. <br>
> It doesn't work for thread_a because tst_atomic_store(exit, &pair->exit)<br>
> will reset it back to 0 (int exit = 0).<br>
<br>
I don't think we have ever handled thread B breaking gracefully?<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Right, that exist before Edward's patch :).<br></div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
If B breaks and it calls tst_fzsync_pair_cleanup then it will try to<br>
join to itself and we will probably get EDEADLK.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Exactly, maybe do something to make tst_fzsync_pair_cleanup</div><div class="gmail_default" style="font-size:small">avoid joining to itself when the invoke come from B?</div><br></div><div>  </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> +                       tst_atomic_store(1, &pair->exit);<br>
> +                       usleep(100000);<br>
<br>
Why do we need usleep?<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Seems not very needed. </div></div><div><br></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>