aboutsummaryrefslogtreecommitdiff
path: root/src/core/platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/platform.h')
-rw-r--r--src/core/platform.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/core/platform.h b/src/core/platform.h
index 355ef7eb..53d25137 100644
--- a/src/core/platform.h
+++ b/src/core/platform.h
@@ -1,5 +1,5 @@
//
-// Copyright 2019 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
// Copyright 2018 Devolutions <info@devolutions.net>
//
@@ -189,13 +189,18 @@ extern uint64_t nni_atomic_swap64(nni_atomic_u64 *, uint64_t);
extern uint64_t nni_atomic_dec64_nv(nni_atomic_u64 *);
extern void nni_atomic_inc64(nni_atomic_u64 *);
+// nni_atomic_cas64 is a compare and swap. The second argument is the
+// value to compare against, and the third is the new value. Returns
+// true if the value was set.
+extern bool nni_atomic_cas64(nni_atomic_u64 *, uint64_t, uint64_t);
+
//
// Clock Support
//
// nn_plat_clock returns a number of milliseconds since some arbitrary time
// in the past. The values returned by nni_clock must use the same base
-// as the times used in nni_plat_cond_waituntil. The nni_plat_clock() must
+// as the times used in nni_plat_cond_until. The nni_plat_clock() must
// return values > 0, and must return values smaller than 2^63. (We could
// relax this last constraint, but there is no reason to, and leaves us the
// option of using negative values for other purposes in the future.)
@@ -213,9 +218,9 @@ uint32_t nni_random(void);
// nni_plat_init is called to allow the platform the chance to
// do any necessary initialization. This routine MUST be idempotent,
-// and threadsafe, and will be called before any other API calls, and
+// and thread-safe, and will be called before any other API calls, and
// may be called at any point thereafter. It is permitted to return
-// an error if some critical failure inializing the platform occurs,
+// an error if some critical failure initializing the platform occurs,
// but once this succeeds, all future calls must succeed as well, unless
// nni_plat_fini has been called.
//
@@ -274,7 +279,7 @@ extern int nni_tcp_dialer_getopt(
extern int nni_tcp_listener_init(nni_tcp_listener **);
// nni_tcp_listener_fini frees the listener and all associated resources.
-// It implictly closes the listener as well.
+// It implicitly closes the listener as well.
extern void nni_tcp_listener_fini(nni_tcp_listener *);
// nni_tcp_listener_close closes the listener. This will unbind