From 6d92c73e5cdf93fe70b0646e78a250e01a8d2f65 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 11 Jan 2020 13:15:40 -0800 Subject: XREQ and others race on TTL. The TTL in these cases should have been atomic. To facilitate things we actually introduce an atomic int for convenience. We also introduce a convenience nni_msg_must_append_u32() and nni_msg_header_must_append_u32(), so that we can eliminate some failure tests that cannot ever happen. Combined with a new test for xreq, we have 100% coverage for xreq and more coverage for the other REQ/REP protocols. --- src/platform/posix/posix_impl.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/platform/posix/posix_impl.h') diff --git a/src/platform/posix/posix_impl.h b/src/platform/posix/posix_impl.h index a1cb62c5..3ec66b6b 100644 --- a/src/platform/posix/posix_impl.h +++ b/src/platform/posix/posix_impl.h @@ -83,6 +83,10 @@ struct nni_atomic_flag { atomic_flag f; }; +struct nni_atomic_int { + atomic_int v; +}; + struct nni_atomic_u64 { atomic_uint_fast64_t v; }; @@ -100,6 +104,10 @@ struct nni_atomic_bol { bool b; }; +struct nni_atomic_int { + int v; +}; + struct nni_atomic_u64 { uint64_t v; }; -- cgit v1.2.3-70-g09d2