diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/defs.h | 8 | ||||
| -rw-r--r-- | src/core/thread.c | 20 | ||||
| -rw-r--r-- | src/core/thread.h | 8 |
3 files changed, 14 insertions, 22 deletions
diff --git a/src/core/defs.h b/src/core/defs.h index 98ff5b97..69fe4843 100644 --- a/src/core/defs.h +++ b/src/core/defs.h @@ -39,10 +39,10 @@ typedef struct nni_proto_sock_ops nni_proto_sock_ops; typedef struct nni_proto_pipe_ops nni_proto_pipe_ops; typedef struct nni_proto nni_proto; -typedef struct nni_mtx nni_mtx; -typedef struct nni_cv nni_cv; -typedef struct nni_idhash nni_idhash; -typedef struct nni_thr nni_thr; +typedef struct nni_plat_mtx nni_mtx; +typedef struct nni_plat_cv nni_cv; +typedef struct nni_idhash nni_idhash; +typedef struct nni_thr nni_thr; typedef void (*nni_thr_func)(void *); typedef int nni_signal; // Wakeup channel. diff --git a/src/core/thread.c b/src/core/thread.c index e603e32b..3cfdd83f 100644 --- a/src/core/thread.c +++ b/src/core/thread.c @@ -12,43 +12,43 @@ int nni_mtx_init(nni_mtx *mtx) { - return (nni_plat_mtx_init(&mtx->mtx)); + return (nni_plat_mtx_init(mtx)); } void nni_mtx_fini(nni_mtx *mtx) { - nni_plat_mtx_fini(&mtx->mtx); + nni_plat_mtx_fini(mtx); } void nni_mtx_lock(nni_mtx *mtx) { - nni_plat_mtx_lock(&mtx->mtx); + nni_plat_mtx_lock(mtx); } void nni_mtx_unlock(nni_mtx *mtx) { - nni_plat_mtx_unlock(&mtx->mtx); + nni_plat_mtx_unlock(mtx); } int nni_cv_init(nni_cv *cv, nni_mtx *mtx) { - return (nni_plat_cv_init(&cv->cv, &mtx->mtx)); + return (nni_plat_cv_init(cv, mtx)); } void nni_cv_fini(nni_cv *cv) { - nni_plat_cv_fini(&cv->cv); + nni_plat_cv_fini(cv); } void nni_cv_wait(nni_cv *cv) { - nni_plat_cv_wait(&cv->cv); + nni_plat_cv_wait(cv); } int @@ -57,20 +57,20 @@ nni_cv_until(nni_cv *cv, nni_time until) // Some special cases for times. Catching these here means that // platforms can assume a valid time is presented to them. if (until == NNI_TIME_NEVER) { - nni_plat_cv_wait(&cv->cv); + nni_plat_cv_wait(cv); return (0); } if (until == NNI_TIME_ZERO) { return (NNG_EAGAIN); } - return (nni_plat_cv_until(&cv->cv, until)); + return (nni_plat_cv_until(cv, until)); } void nni_cv_wake(nni_cv *cv) { - nni_plat_cv_wake(&cv->cv); + nni_plat_cv_wake(cv); } static void diff --git a/src/core/thread.h b/src/core/thread.h index ebd8db83..b528af2c 100644 --- a/src/core/thread.h +++ b/src/core/thread.h @@ -13,14 +13,6 @@ #include "core/defs.h" #include "core/platform.h" -struct nni_mtx { - nni_plat_mtx mtx; -}; - -struct nni_cv { - nni_plat_cv cv; -}; - struct nni_thr { nni_plat_thr thr; nni_plat_mtx mtx; |
