Skip to content

Commit 6393617

Browse files
authored
stop_aio() now resets the R interrupts state (#196)
* Add interrupt state reset * Enable for Windows * Polish docs * Add news item * Rename functions and add tests * Remove separate interface and include within `stop_aio()` * Add comment * Make consistent for pipe connections
1 parent 82638a7 commit 6393617

File tree

8 files changed

+14
-35
lines changed

8 files changed

+14
-35
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: nanonext
33
Title: NNG (Nanomsg Next Gen) Lightweight Messaging Library
4-
Version: 1.7.0.9000
4+
Version: 1.7.0.9002
55
Authors@R: c(
66
person("Charlie", "Gao", , "[email protected]", role = c("aut", "cre"),
77
comment = c(ORCID = "0000-0002-0750-061X")),

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export("%~>%")
4444
export("opt<-")
4545
export(.advance)
4646
export(.context)
47-
export(.interrupt)
4847
export(.keep)
4948
export(.mark)
5049
export(.read_header)

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# nanonext (development version)
22

3+
#### Updates
4+
5+
* The `cv` arguments at `recv_aio()` and `request()` have been simplified.
6+
37
# nanonext 1.7.0
48

59
#### Behavioural Changes

R/utils.R

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -401,19 +401,6 @@ ip_addr <- function() .Call(rnng_ip_addr)
401401
#'
402402
.read_marker <- function(x) .Call(rnng_marker_read, x)
403403

404-
#' Interrupt Switch
405-
#'
406-
#' Internal package function. No longer used.
407-
#'
408-
#' @param x logical value.
409-
#'
410-
#' @return The logical value `x` supplied.
411-
#'
412-
#' @keywords internal
413-
#' @export
414-
#'
415-
.interrupt <- function(x = TRUE) x
416-
417404
#' Internal Package Function
418405
#'
419406
#' Only present for cleaning up after running examples and tests. Do not attempt

man/dot-interrupt.Rd

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/aio.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,13 @@ SEXP rnng_aio_stop(SEXP x) {
456456
if (NANO_PTR_CHECK(coreaio, nano_AioSymbol)) break;
457457
nano_aio *aiop = (nano_aio *) NANO_PTR(coreaio);
458458
nng_aio_stop(aiop->aio);
459+
// See #194, this is to reset the R interrupts state after an interrupt
460+
// requested by `stop_request()` has already triggered
461+
#ifdef _WIN32
462+
UserBreak = 0;
463+
#else
464+
R_interrupts_pending = 0;
465+
#endif
459466
break;
460467
case VECSXP: ;
461468
const R_xlen_t xlen = Rf_xlength(x);

src/sync.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ void pipe_cb_signal(nng_pipe p, nng_pipe_ev ev, void *arg) {
149149
nng_mtx_unlock(mtx);
150150
if (sig > 1) {
151151
#ifdef _WIN32
152+
if (sig == SIGINT)
153+
UserBreak = 1;
152154
raise(sig);
153155
#else
154156
if (sig == SIGINT)

tests/tests.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,6 @@ if (promises) { later::run_now(1L); later::run_now() }
649649
test_type("character", ip_addr())
650650
test_type("character", names(ip_addr()))
651651
test_null(write_stdout(""))
652-
test_true(.interrupt())
653-
test_false(.interrupt(FALSE))
654652
test_false(identical(get0(".Random.seed"), {.advance(); .Random.seed}))
655653
test_type("integer", .Call(nanonext:::rnng_traverse_precious))
656654

0 commit comments

Comments
 (0)