[LTP] [PATCH v3 3/7] fzsync: Add long running thread support and deviation stats
Cyril Hrubis
chrubis@suse.cz
Tue Sep 12 16:43:25 CEST 2017
Hi!
> +/**
> + * tst_fzsync_pair_wait - Wait for the other thread
> + * @our_cntr: The counter for the thread we are on
> + * @other_cntr: The counter for the thread we are synchronising with
> + *
> + * Use this (through tst_fzsync_pair_wait_a() and tst_fzsync_pair_wait_b()) if
> + * you need an additional synchronisation point in a thread or you do not want
> + * to use the delay facility (not recommended). See
> + * tst_fzsync_pair_wait_update().
> + *
> + * Returns a non-zero value if the thread should continue otherwise the
> + * calling thread should exit.
> + */
> +static inline int tst_fzsync_pair_wait(struct tst_fzsync_pair *pair,
> + int *our_cntr, int *other_cntr)
> +{
> + tst_atomic_inc(other_cntr);
> + while (tst_atomic_load(our_cntr) < tst_atomic_load(other_cntr)
> + && !tst_atomic_load(&pair->exit))
> + ;
> +
> + return !tst_atomic_load(&pair->exit);
> +}
Also what happens if the counters overflow?
I guess that this will happen if we call the test with large enough -i
paramter, right?
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list