similar to: Interrupting C++ code execution

Displaying 20 results from an estimated 3000 matches similar to: "Interrupting C++ code execution"

2010 Sep 28
1
checking user interrupts in C(++) code
Hello, My problem is that I have an extension in C++ that can be quite time-consuming. I'd like to make it interruptible. The problem is that if I use the recommended R_CheckUserInterrupt() method I have no possibility to cleanup (e.g. free the memory). I've seen an old thread about this, but I wonder if there's a new and definitive answer. I just do not understand why a simple
2009 Jan 16
1
interrupting R from a GUI
list(...), I am looking for a way to interrupt R from a callback: specifically, to interrupt plotting (typically on a cairoDevice, but would be good if it worked with other devices too). Of course, one can interrupt R nicely from the console with Ctrl-C (or Esc in Rgui), but I need to do it from a GUI. Callbacks run in a new thread, so obviously stop() etc will not work. I tried to look into how
2024 Dec 18
2
R_CheckUserInterrupt() can be a performance bottleneck within GUIs
It seems benign, but has implications since checking time is actually not a cheap operation: adding jus ta time check alone incurs a penalty of ca. 700% compared with the time it takes to call R_CheckUserInterrupt(). Generally, it makes no sense to check interrupts at every iteration - you'll find code like if (++i % 10000 == 0) R_CheckUserInterrupt(); in loops to make sure it's not called
2024 Dec 17
1
R_CheckUserInterrupt() can be a performance bottleneck within GUIs
This seems like a great idea. Would it help to escalate this to a post on R-bugzilla, so it is less likely to fall through the cracks? On 12/17/24 09:51, Jeroen Ooms wrote: > A more generic solution would be for R to throttle calls to > R_CheckUserInterrupt(), because it makes no sense to check 1000 times > per second if a user has interrupted, but it is difficult for the > caller to
2024 Dec 17
1
R_CheckUserInterrupt() can be a performance bottleneck within GUIs
A more generic solution would be for R to throttle calls to R_CheckUserInterrupt(), because it makes no sense to check 1000 times per second if a user has interrupted, but it is difficult for the caller to know when R_CheckUserInterrupt() has been last called, or do it regularly without over-doing it. Here is a simple patch: https://github.com/r-devel/r-svn/pull/125 See also:
2024 Dec 18
1
R_CheckUserInterrupt() can be a performance bottleneck within GUIs
On 12/18/24 01:19, Simon Urbanek wrote: > It seems benign, but has implications since checking time is actually not a cheap operation: adding jus ta time check alone incurs a penalty of ca. 700% compared with the time it takes to call R_CheckUserInterrupt(). Generally, it makes no sense to check interrupts at every iteration - you'll find code like if (++i % 10000 == 0)
2024 Dec 17
1
R_CheckUserInterrupt() can be a performance bottleneck within GUIs
tl;dr: R_CheckUserInterrupt() can be a performance bottleneck within GUIs. This also affects functions in the 'stats' package, which could be improved by changing the position of calls to R_CheckUserInterrupt(). Dear all, Recently I was puzzled because some code in a package under development, which consisted almost entirely of a .Call() to a function written in
2023 May 02
1
save.image Non-responsive to Interrupt
? Sat, 29 Apr 2023 00:00:02 +0000 Dario Strbenac via R-devel <r-devel at r-project.org> ?????: > Could save.image() be redesigned so that it promptly responds to > Ctrl+C? It prevents the command line from being used for a number of > hours if the contents of the workspace are large. This is ultimately caused by serialize() being non-interruptible. A relatively simple way to hang
2008 Apr 14
1
clean-up actions after non-local exits
Dear R-devel, Some time ago I started a thread that boiled down to clean-up actions after non-local exits in R, see below. I wonder if there has been any progress on this? R-ext 2.6.1 doesn't say much on the subject. How, for example, do people deal with a situation where their C (C++) function opens a file and then receives a signal or longjump-s on error(), how do they make sure the
2005 Feb 11
1
Re: [R-SIG-Mac] Bug running pbinom() in R-GUI?
On Feb 10, 2005, at 7:38 PM, George W. Gilchrist wrote: > Today I was running a graduate level stats lab using R and we > encountered a > major problem while using the current build of the Cocoa GUI: > >> From the GUI: >> system.time(pbinom(80, 1e5, 806/1e6)) > [1] 14.37 4.94 30.29 0.00 0.00 >> > >> From the command line on the same machine: >>
2003 Oct 10
4
1.8.0 on Unix: interrupting huge print()s ??
NEWS for R 1.8.0 has >> USER-VISIBLE CHANGES >> >> <......> >> >> o On Unix-like systems interrupt signals now set a flag that is >> checked periodically rather than calling longjmp from the >> signal handler. This is analogous to the behavior on Windows. >> This reduces responsiveness to interrupts but prevents bugs
2004 Jun 14
5
mkChar can be interrupted
Hi, As was discussed earlier in another thread and as documented in R-exts .Call() should not be interruptible by Ctrl-C. However the following code, which spends most of its time inside mkChar, turned out to be interruptible on RH-7.3 R-1.8.1 gcc-2.96: #include <Rinternals.h> #include <R.h> SEXP foo0(const SEXP nSexp) { int i, n; SEXP resSexp; if (!isInteger(nSexp))
2019 Apr 30
2
Background R session on Unix and SIGINT
Yeah, I get that they are async. What happens is that the background process is not doing anything when the process gets a SIGINT. I.e. the background process is just listening on its standard input. AFAICT for an interactive process such a SIGINT is just swallowed, with a newline outputted to the terminal. But apparently, for this background process, it is not swallowed, and it is triggered
2019 Apr 15
2
Feature request: make file.exists interruptable
Hi R developers, On slow file systems with large lists of files, file.exists can take a long time to run. It would be nice if users could interrupt this function. I think it would be simple to add: https://svn.r-project.org/R/trunk/src/main/platform.c, at line 1373, add "R_CheckUserInterrupt();" perhaps every some number of iterations if performance is a concern here. Thanks, Chris
2012 May 22
1
Capturing signals from within external libs
I have a continuous loop running in an external library that I am calling from C (R API). This loop is processing events in real time with the possibility of significant lag between events. When processing an event, I can make use of R_CheckUserInterrupt, but while the external library code is waiting on a new event, I don't have an opportunity to call this - my entry points are only on
2011 Aug 08
1
heavy processing during R_init_XXXXX()
Hi. Need some advice. I have to load a library during R_init_XXXXX() with dlopen(). The library file is 23 megabytes long and loads several other libraries. Everything happens during dlopen() execution, out of control, and takes around 1 second on first load in a quadcore. Besides, due to security reasons, a hash of the library file is going to be computed. Still do not know how long it will
2019 Apr 30
2
[External] Re: Background R session on Unix and SIGINT
Unfortunately --interactive also makes the session interactive(), which is bad for me, as it is a background session. In general, I don't want the interactive behavior, but was wondering if I could send as SIGINT to try to interrupt the computation of the background process, and if that does not work, then I would send a SIGKILL and start up another process. It all works nicely, except for
2007 Feb 27
1
Checking for user interrupt in a .C() call without without triggering a non-local exit.
Hi, An R package on which I am working makes a series of very computationally-intensive and complex .C() calls, that I would like to make interruptible. However, calling R_CheckUserInterrupt() causes a non-local exit, so the memory allocated by malloc() is never freed. The way the code is structured, it might not be practical to replace all the malloc() calls with R_alloc() calls. The question
2019 Apr 30
2
Background R session on Unix and SIGINT
OK, I managed to create an example without callr, but it is still somewhat cumbersome. Anyway, here it is. Terminal 1: mkfifo fif R --no-readline --slave --no-save --no-restore < fif Terminal 2: cat > fif Sys.getpid() This will make Terminal 1 print the pid of the R process, so we can send a SIGINT: Terminal 3: kill -INT pid The R process is of course still running happily. Terminal 2
2013 May 01
2
Catch SIGINT from user in backend C++ code
Hi, I was wondering if anybody knew how to trap SIGINTs (ie Ctrl-C) in backend C++ code for R extensions? I'm writing a package that uses the GPU for some hefty matrix operations in a tightly coupled parallel algorithm implemented in CUDA. The problem is that once running, the C++ module cannot apparently be interrupted by a SIGINT, leaving the user sat waiting even if they realise