seqc: predict false for _in_modify and type fixes for _consistent_*

seqc_consistent_* return bool, not seqc. [0]

While here annotate the rarely true condition - it is expected to run
into it on vare occasion (compared to the other case).

Reported by:	oshogbo [0]
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
mjg 2019-08-21 04:54:48 +00:00
parent 39f2ea05bf
commit 17d1470975

View File

@ -78,7 +78,7 @@ seqc_read(const seqc_t *seqcp)
for (;;) {
ret = atomic_load_acq_int(__DECONST(seqc_t *, seqcp));
if (seqc_in_modify(ret)) {
if (__predict_false(seqc_in_modify(ret))) {
cpu_spinwait();
continue;
}
@ -88,14 +88,14 @@ seqc_read(const seqc_t *seqcp)
return (ret);
}
static __inline seqc_t
static __inline bool
seqc_consistent_nomb(const seqc_t *seqcp, seqc_t oldseqc)
{
return (*seqcp == oldseqc);
}
static __inline seqc_t
static __inline bool
seqc_consistent(const seqc_t *seqcp, seqc_t oldseqc)
{