aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/aio.c24
-rw-r--r--src/core/aio.h14
2 files changed, 19 insertions, 19 deletions
diff --git a/src/core/aio.c b/src/core/aio.c
index bbeb5cef..81020bbb 100644
--- a/src/core/aio.c
+++ b/src/core/aio.c
@@ -296,7 +296,7 @@ nni_aio_get_output(nni_aio *aio, unsigned index)
return (NULL);
}
-int
+nng_err
nni_aio_result(nni_aio *aio)
{
return (aio->a_result);
@@ -325,7 +325,7 @@ nni_aio_busy(nni_aio *aio)
void
nni_aio_reset(nni_aio *aio)
{
- aio->a_result = 0;
+ aio->a_result = NNG_OK;
aio->a_count = 0;
aio->a_abort = false;
aio->a_expire_ok = false;
@@ -362,7 +362,7 @@ nni_aio_start(nni_aio *aio, nni_aio_cancel_fn cancel, void *data)
if (!aio->a_sleep) {
aio->a_expire_ok = false;
}
- aio->a_result = 0;
+ aio->a_result = NNG_OK;
// Do this outside the lock. Note that we don't strictly need to have
// done this for the failure cases below (the task framework does the
@@ -388,14 +388,14 @@ nni_aio_start(nni_aio *aio, nni_aio_cancel_fn cancel, void *data)
aio->a_abort = false;
aio->a_expire_ok = false;
aio->a_count = 0;
- NNI_ASSERT(aio->a_result != 0);
+ NNI_ASSERT(aio->a_result != NNG_OK);
nni_mtx_unlock(&eq->eq_mtx);
nni_task_dispatch(&aio->a_task);
return (false);
}
if (timeout) {
aio->a_sleep = false;
- aio->a_result = aio->a_expire_ok ? 0 : NNG_ETIMEDOUT;
+ aio->a_result = aio->a_expire_ok ? NNG_OK : NNG_ETIMEDOUT;
aio->a_expire_ok = false;
aio->a_count = 0;
nni_mtx_unlock(&eq->eq_mtx);
@@ -419,7 +419,7 @@ nni_aio_start(nni_aio *aio, nni_aio_cancel_fn cancel, void *data)
// nni_aio_abort is called by a consumer which guarantees that the aio
// is still valid.
void
-nni_aio_abort(nni_aio *aio, int rv)
+nni_aio_abort(nni_aio *aio, nng_err rv)
{
if (aio != NULL && aio->a_init) {
nni_aio_cancel_fn fn;
@@ -451,7 +451,7 @@ nni_aio_abort(nni_aio *aio, int rv)
static void
nni_aio_finish_impl(
- nni_aio *aio, int rv, size_t count, nni_msg *msg, bool sync)
+ nni_aio *aio, nng_err rv, size_t count, nni_msg *msg, bool sync)
{
nni_aio_expire_q *eq = aio->a_expire_q;
@@ -479,21 +479,21 @@ nni_aio_finish_impl(
}
void
-nni_aio_finish(nni_aio *aio, int result, size_t count)
+nni_aio_finish(nni_aio *aio, nng_err result, size_t count)
{
nni_aio_finish_impl(aio, result, count, NULL, false);
}
void
-nni_aio_finish_sync(nni_aio *aio, int result, size_t count)
+nni_aio_finish_sync(nni_aio *aio, nng_err result, size_t count)
{
nni_aio_finish_impl(aio, result, count, NULL, true);
}
void
-nni_aio_finish_error(nni_aio *aio, int result)
+nni_aio_finish_error(nni_aio *aio, nng_err result)
{
- nni_aio_finish_impl(aio, result, 0, NULL, false);
+ nni_aio_finish_impl(aio, result, NNG_OK, NULL, false);
}
void
@@ -539,7 +539,7 @@ nni_aio_completions_init(nni_aio_completions *clp)
void
nni_aio_completions_add(
- nni_aio_completions *clp, nni_aio *aio, int result, size_t count)
+ nni_aio_completions *clp, nni_aio *aio, nng_err result, size_t count)
{
NNI_ASSERT(!nni_aio_list_active(aio));
aio->a_reap_node.rn_next = *clp;
diff --git a/src/core/aio.h b/src/core/aio.h
index cbf2c919..25475323 100644
--- a/src/core/aio.h
+++ b/src/core/aio.h
@@ -85,7 +85,7 @@ extern nni_msg *nni_aio_get_msg(nni_aio *);
// for the operation. It is only valid to call this when the operation is
// complete (such as when the callback is executed or after nni_aio_wait
// is performed).
-extern int nni_aio_result(nni_aio *);
+extern nng_err nni_aio_result(nni_aio *);
// nni_aio_count returns the number of bytes of data transferred, if any.
// As with nni_aio_result, it is only defined if the I/O operation has
@@ -114,19 +114,19 @@ extern void nni_aio_list_remove(nni_aio *);
extern int nni_aio_list_active(nni_aio *);
// nni_aio_finish is called by the provider when an operation is complete.
-extern void nni_aio_finish(nni_aio *, int, size_t);
+extern void nni_aio_finish(nni_aio *, nng_err, size_t);
// nni_aio_finish_sync is to be called when a synchronous completion is
// desired. It is very important that the caller not hold any locks when
// calling this, but it is useful for chaining completions to minimize
// context switch overhead during completions.
-extern void nni_aio_finish_sync(nni_aio *, int, size_t);
-extern void nni_aio_finish_error(nni_aio *, int);
+extern void nni_aio_finish_sync(nni_aio *, nng_err, size_t);
+extern void nni_aio_finish_error(nni_aio *, nng_err);
extern void nni_aio_finish_msg(nni_aio *, nni_msg *);
// nni_aio_abort is used to abort an operation. Any pending I/O or
// timeouts are canceled if possible, and the callback will be returned
// with the indicated result (NNG_ECLOSED or NNG_ECANCELED is recommended.)
-extern void nni_aio_abort(nni_aio *, int rv);
+extern void nni_aio_abort(nni_aio *, nng_err);
extern void *nni_aio_get_prov_data(nni_aio *);
extern void nni_aio_set_prov_data(nni_aio *, void *);
@@ -186,7 +186,7 @@ extern void nni_aio_completions_run(nni_aio_completions *);
// appropriate) to the completion list. This should be done while the
// appropriate lock is held. The aio must not be scheduled.
extern void nni_aio_completions_add(
- nni_aio_completions *, nni_aio *, int, size_t);
+ nni_aio_completions *, nni_aio *, nng_err, size_t);
extern int nni_aio_sys_init(nng_init_params *);
extern bool nni_aio_sys_drain(void);
@@ -206,7 +206,7 @@ struct nng_aio {
size_t a_count; // Bytes transferred (I/O only)
nni_time a_expire; // Absolute timeout
nni_duration a_timeout; // Relative timeout
- int a_result; // Result code (nng_errno)
+ nng_err a_result; // Result code (nng_errno)
bool a_stop; // Shutting down (no new operations)
bool a_sleep; // Sleeping with no action
bool a_expire_ok; // Expire from sleep is ok