From: APN on
How can a script tell if the Tcl event loop is running or not ? I want
to do a vwait forever but only if there isn't already an event loop
running..

/Ashok
From: Alexandre Ferrieux on
On Sep 3, 4:21 pm, APN <palm...(a)yahoo.com> wrote:
> How can a script tell if the Tcl event loop is running or not ? I want
> to do a vwait forever but only if there isn't already an event loop
> running..

Not sure this kind of magic is desirable. From the caller's point of
view, it means that in one case the function will block (for a long
time) and in the other it will return immediately, right ? I for one
like to be in control of such things, with a 'blocking' flag or vararg
syntax like [after]...

-Alex
From: Cameron Laird on
In article <bd52ad41-81a9-4bbf-82a2-d87e8e400b05(a)j19g2000yqk.googlegroups.com>,
Alexandre Ferrieux <alexandre.ferrieux(a)gmail.com> wrote:
>On Sep 3, 4:21�pm, APN <palm...(a)yahoo.com> wrote:
>> How can a script tell if the Tcl event loop is running or not ? I want
>> to do a vwait forever but only if there isn't already an event loop
>> running..
>
>Not sure this kind of magic is desirable. From the caller's point of
>view, it means that in one case the function will block (for a long
>time) and in the other it will return immediately, right ? I for one
>like to be in control of such things, with a 'blocking' flag or vararg
>syntax like [after]...
>
>-Alex

I doubt he's thinking of it as magic, Alexandre; my speculation
is that he has a ten-line script, and wants pleasingly indistin-
guishable results whether he runs inside wish or tclsh.

The answer, I believe, is that there's no good answer. I welcome
correction.
From: tom.rmadilo on
On Sep 3, 8:54 am, cla...(a)lairds.us (Cameron Laird) wrote:
> my speculation
> is that he has a ten-line script, and wants pleasingly indistin-
> guishable results whether he runs inside wish or tclsh.
>
> The answer, I believe, is that there's no good answer.  I welcome
> correction.

I'm clueless, but you can distinguish between wish and tclsh:
tom(a)boron:~$ tclsh
% info nameofexecutable
/usr/bin/tclsh
% exit
tom(a)boron:~$ wish
% info nameofexecutable
/usr/bin/wish

Seems like a crude solution even if it works.
From: APN on
Cameron, you are exactly right as to my intent. Currently, I look to
see whether Tk is loaded to distinguish, but the correct thing seemed
to be not to check for Tk but for the event loop since that is what is
important.

/Ashok

On Sep 3, 8:54 pm, cla...(a)lairds.us (Cameron Laird) wrote:
> In article <bd52ad41-81a9-4bbf-82a2-d87e8e400...(a)j19g2000yqk.googlegroups..com>,
> Alexandre Ferrieux  <alexandre.ferri...(a)gmail.com> wrote:
>
> >On Sep 3, 4:21 pm, APN <palm...(a)yahoo.com> wrote:
> >> How can a script tell if the Tcl event loop is running or not ? I want
> >> to do a vwait forever but only if there isn't already an event loop
> >> running..
>
> >Not sure this kind of magic is desirable. From the caller's point of
> >view, it means that in one case the function will block (for a long
> >time) and in the other it will return immediately, right ? I for one
> >like to be in control of such things, with a 'blocking' flag or vararg
> >syntax like [after]...
>
> >-Alex
>
> I doubt he's thinking of it as magic, Alexandre; my speculation
> is that he has a ten-line script, and wants pleasingly indistin-
> guishable results whether he runs inside wish or tclsh.
>
> The answer, I believe, is that there's no good answer.  I welcome
> correction.