Skip to content

Commit

Permalink
also register interrupts at raio_complete
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Dec 2, 2024
1 parent cf9ea4f commit 133b961
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: nanonext
Type: Package
Title: NNG (Nanomsg Next Gen) Lightweight Messaging Library
Version: 1.3.2.9010
Version: 1.3.2.9011
Description: R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is
a socket library implementing 'Scalability Protocols', a reliable,
high-performance standard for common communications patterns including
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# nanonext 1.3.2.9010 (development)
# nanonext 1.3.2.9011 (development)

#### New Features

Expand Down
18 changes: 0 additions & 18 deletions src/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,6 @@ static void isaio_complete(void *arg) {

}

static void raio_complete(void *arg) {

nano_aio *raio = (nano_aio *) arg;
int res = nng_aio_result(raio->aio);
if (res == 0) {
nng_msg *msg = nng_aio_get_msg(raio->aio);
raio->data = msg;
nng_pipe p = nng_msg_get_pipe(msg);
res = - (int) p.id;
}

raio->result = res;

if (raio->cb != NULL)
later2(raio_invoke_cb, raio->cb);

}

static void iraio_complete(void *arg) {

nano_aio *iaio = (nano_aio *) arg;
Expand Down
26 changes: 26 additions & 0 deletions src/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,32 @@ static SEXP nano_outHook(SEXP x, SEXP fun) {

// functions with forward definitions in nanonext.h ----------------------------

void raio_complete(void *arg) {

nano_aio *raio = (nano_aio *) arg;
int res = nng_aio_result(raio->aio);
if (res == 0) {
nng_msg *msg = nng_aio_get_msg(raio->aio);
raio->data = msg;
nng_pipe p = nng_msg_get_pipe(msg);
res = - (int) p.id;
}

raio->result = res;

if (raio->cb != NULL)
later2(raio_invoke_cb, raio->cb);

if (nano_interrupt) {
#ifdef _WIN32
UserBreak = 1;
#else
kill(getpid(), SIGINT);
#endif
}

}

void raio_complete_signal(void *arg) {

nano_aio *raio = (nano_aio *) arg;
Expand Down
1 change: 1 addition & 0 deletions src/nanonext.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ SEXP R_mkClosure(SEXP, SEXP, SEXP);
SEXP nano_findVarInFrame(const SEXP, const SEXP);
SEXP nano_PreserveObject(const SEXP);
void nano_ReleaseObject(SEXP);
void raio_complete(void *);
void raio_complete_signal(void *);
void sendaio_complete(void *);
void cv_finalizer(SEXP);
Expand Down

0 comments on commit 133b961

Please sign in to comment.