From murdoch at stats.uwo.ca  Thu Sep 18 15:28:42 2008
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Thu, 18 Sep 2008 09:28:42 -0400
Subject: [Rd] Rterm.exe, windows event loop running in multiple threads?
In-Reply-To: <509e0620809180559k6c18a6e1he065daa5bd5a08d7@mail.gmail.com>
References: <509e0620809180559k6c18a6e1he065daa5bd5a08d7@mail.gmail.com>
Message-ID: <48D2578A.5040202@stats.uwo.ca>

On 18/09/2008 8:59 AM, Michael Lawrence wrote:
> For processing events, RGtk2 has moved away from using the old tcl_do hack
> and now synchronizes on the Windows event loop. In Rgui.exe this works fine
> (well mostly), but in Rterm.exe, users report the following warning from
> GLib: "main loop already active in another thread". The most obvious way
> this could occur is if the Windows event loop were iterating in multiple
> threads. This does not seem to be the case from my casual inspection of the
> R source.

Rterm sets up separate threads to handle Windows messages and console 
input, so that the graphics devices can be updated while the console is 
waiting for input.  You can see the source in src/gnuwin32/system.c: 
look for "lineavailable", which indicates that the reader thread has 
read something.

Duncan Murdoch



[Rd] Rterm.exe, windows event loop running in multiple threads?
Duncan Murdoch