Skip to content

Commit 50dd849

Browse files
committed
Safer interrupts
1 parent 82638a7 commit 50dd849

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
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.9001
55
Authors@R: c(
66
person("Charlie", "Gao", , "[email protected]", role = c("aut", "cre"),
77
comment = c(ORCID = "0000-0002-0750-061X")),

src/aio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,8 @@ static void raio_complete_interrupt(void *arg) {
149149

150150
if (res <= 0) {
151151
#ifdef _WIN32
152-
UserBreak = 1;
152+
GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
153153
#else
154-
R_interrupts_pending = 1;
155154
kill(getpid(), SIGINT);
156155
#endif
157156
}

src/nanonext.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ typedef struct nano_handle_s {
6363
#ifdef NANONEXT_SIGNALS
6464
#ifndef _WIN32
6565
#include <unistd.h>
66+
#else
67+
#define WIN32_LEAN_AND_MEAN
68+
#include <windows.h>
6669
#endif
6770
#include <signal.h>
6871
#endif
@@ -95,13 +98,6 @@ typedef struct nano_handle_s {
9598
#include <Rinternals.h>
9699
#include <Rversion.h>
97100
#include <R_ext/Visibility.h>
98-
#if defined(NANONEXT_SIGNALS)
99-
#ifdef _WIN32
100-
#include <Rembedded.h>
101-
#else
102-
extern int R_interrupts_pending;
103-
#endif
104-
#endif
105101

106102
#define NANO_PTR(x) (void *) CAR(x)
107103
#define NANO_PTR_CHECK(x, tag) (TAG(x) != tag || NANO_PTR(x) == NULL)

src/sync.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ void pipe_cb_signal(nng_pipe p, nng_pipe_ev ev, void *arg) {
151151
#ifdef _WIN32
152152
raise(sig);
153153
#else
154-
if (sig == SIGINT)
155-
R_interrupts_pending = 1;
156154
kill(getpid(), sig);
157155
#endif
158156

0 commit comments

Comments
 (0)