aboutsummaryrefslogtreecommitdiff
path: root/src/platform/windows
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform/windows')
-rw-r--r--src/platform/windows/win_impl.h4
-rw-r--r--src/platform/windows/win_thread.c12
2 files changed, 16 insertions, 0 deletions
diff --git a/src/platform/windows/win_impl.h b/src/platform/windows/win_impl.h
index 0bd12b24..73dc3660 100644
--- a/src/platform/windows/win_impl.h
+++ b/src/platform/windows/win_impl.h
@@ -48,6 +48,10 @@ struct nni_plat_cv {
PSRWLOCK srl;
};
+struct nni_atomic_flag {
+ unsigned f;
+};
+
// nni_win_event is used with io completion ports. This allows us to get
// to a specific completion callback without requiring the poller (in the
// completion port) to know anything about the event itself. We also use
diff --git a/src/platform/windows/win_thread.c b/src/platform/windows/win_thread.c
index a3d932aa..243811a0 100644
--- a/src/platform/windows/win_thread.c
+++ b/src/platform/windows/win_thread.c
@@ -103,6 +103,18 @@ nni_plat_cv_fini(nni_plat_cv *cv)
NNI_ARG_UNUSED(cv);
}
+bool
+nni_atomic_flag_test_and_set(nni_atomic_flag *f)
+{
+ return (InterlockedExchange(&f->f, 1) != 0);
+}
+
+void
+nni_atomic_flag_reset(nni_atomic_flag *f)
+{
+ InterlockedExchange(&f->f, 0);
+}
+
static unsigned int __stdcall nni_plat_thr_main(void *arg)
{
nni_plat_thr *thr = arg;