From c9bbe8eb574fe10ff16cc71a23fcc9b31fb8ed04 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 5 Dec 2021 22:11:24 -0500 Subject: Use static initialization for lists and mutexes. This eliminates some run-time initialization, moving it to compile time. Additional follow up work will expand on this to simplify initialization and reduce the need for certain locks. --- src/platform/windows/win_impl.h | 6 ++++-- src/platform/windows/win_thread.c | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/platform/windows') diff --git a/src/platform/windows/win_impl.h b/src/platform/windows/win_impl.h index 608a065e..b3c08edf 100644 --- a/src/platform/windows/win_impl.h +++ b/src/platform/windows/win_impl.h @@ -37,15 +37,17 @@ struct nni_plat_thr { struct nni_plat_mtx { SRWLOCK srl; - DWORD owner; - int init; }; +#define NNI_MTX_INITIALIZER { SRWLOCK_INIT } + struct nni_rwlock { SRWLOCK rwl; BOOLEAN exclusive; }; +#define NNI_RWLOCK_INITIALIZER { SRWLOCK_INIT } + struct nni_plat_cv { CONDITION_VARIABLE cv; PSRWLOCK srl; diff --git a/src/platform/windows/win_thread.c b/src/platform/windows/win_thread.c index 31e783a3..b131c067 100644 --- a/src/platform/windows/win_thread.c +++ b/src/platform/windows/win_thread.c @@ -55,13 +55,11 @@ void nni_plat_mtx_init(nni_plat_mtx *mtx) { InitializeSRWLock(&mtx->srl); - mtx->init = 1; } void nni_plat_mtx_fini(nni_plat_mtx *mtx) { - mtx->init = 0; } void -- cgit v1.2.3-70-g09d2