[Rd] Calling R_PolledEvents from R_CheckUserInterrupt

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Thu, 31 May 2007 13:13:54 -0700

On 5/5/07, Luke Tierney <luke_at_stat.uiowa.edu> wrote:


> However, R_PolledEvents is only called from a limited set of places
> now (including the socket reading code to keep things responsive
> during blocking reads). But it is not called from the interupt
> checking code, which means if a user does something equivalent to
> while (TRUE) {}
> there is not point where events get looked at to see a user interrupt
> action. The current definition of R_CheckUserInterrupt is
> void R_CheckUserInterrupt(void)
> {
> R_CheckStack();
> /* This is the point where GUI systems need to do enough event
> processing to determine whether there is a user interrupt event
> pending. Need to be careful not to do too much event
> processing though: if event handlers written in R are allowed
> to run at this point then we end up with concurrent R
> evaluations and that can cause problems until we have proper
> concurrency support. LT */
> #if ( defined(HAVE_AQUA) || defined(Win32) )
> R_ProcessEvents();
> #else
> if (R_interrupts_pending)
> onintr();
> #endif /* Win32 */
> }
> So only on Windows or Mac do we do event processing. We could add a
> R_PolledEvents() call in the #else bit to support this, though the
> cautions in the comment do need to be kept in mind.

I have been using the following patch to src/main/errors.c for a while without any obvious ill effects. Could we add this to r-devel (with necessary changes for Windows, if any)?


Index: errors.c

+#include <R_ext/eventloop.h>

 #ifndef min
 #define min(a, b) (a<b?a:b)

@@ -117,6 +119,8 @@
 #if ( defined(HAVE_AQUA) || defined(Win32) )

+ R_PolledEvents();

     if (R_interrupts_pending)

 #endif /* Win32 */

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 31 May 2007 - 21:10:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 01 Jun 2007 - 01:34:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.