ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcl-core
tcl-core
Re: [TCLCORE] Slave interpreters, events and atomicity of callbacks
by K2k2e6 other posts by this author
Oct 24 2009 10:15AM messages near this date
Re: [TCLCORE] Slave interpreters, events and atomicity of callbacks | Re: [TCLCORE] Slave interpreters, events and atomicity of callbacks
I will post this on tcl.lang.

But what we are seeing intermittently is that "slaveInterp eval foo" will
get executed inside the timer event handler's stack. That causes trouble
because timer event handler could be in a different namespace as well as
completely different variable scope.

My understanding was that if I did:
interp create foo
foo eval do-something-to-set-up-a-regular-timer-callback
foo eval statement
foo eval statement
foo eval statement
...

The statements should all get evaluated at "stack level 0". We can ascertain
that by doing "foo eval {puts "[info level]"}". But sometimes we see that
the statement is executing at a stack level inside the timer event handler
as well as namespace.

We would like more clarity on this because we would like the Timer callback
to be executed by slave interpreter in an atomic fashion. But clearly, it is
not doing that.

-Pawan



Mark Janssen-6 wrote:
>  
>  Hi,
>  
>  First of all, these types of questions are probably better posed in
>  comp.lang.tcl. This mailing list is for discussion regarding
>  development of the Tcl core.
>  Secondly, in absense of threads Tcl will only execute one thing at a
>  time (even if Tcl is thread enabled). This also means any proc used as
>  a callback will be ran till completion before anything else happens.
>  The behaviour you are seeing seems caused by the fact that variables
>  in a proc are not available globally. And global variables are not
>  available in a proc. The whole slave interp seems a red herring. If
>  you have a complete script that is confusing you please post it to
>  comp.lang.tcl.
>  
>  HTH,
>  Mark
>  
>  On Fri, Oct 23, 2009 at 8:59 PM, k2k2e6 <pawan@[...].org> wrote:
> >
> > Guys
> >
> > I have a question about timer events and their atomicity in slave
> > interpreters.
> >
> > Assume that I do the following:
> > interp create slave
> > slave eval after 1000 proc_foo   # proc foo does some work and repeats
> > the
> > after 1000 proc_foo at the end to repeat
> >
> > slave eval set  i 0
> > slave eval puts $i
> > slave eval set  i 0
> > slave eval puts $i
> > ...
> >
> > My question is, when the proc_foo is called, does it execute to
> > completion
> > before any of my subsequent statements get executed or my subsequent
> > statements are interleaved with the statements of proc_foo?
> >
> > We are seeing a problem with interleaving because one can set the
> > variable
> > in the context of proc_foo and then try to get the variable "i" outside
> > the
> > context and one gets "variable not found error".
> >
> > So in slave interpreters, are timer callbacks executed "atomically"?
> >
> > We are seeing that it is not using ActiveState Tcl 8.4.19.2 threaded
> > distribution. The documentation does not clearly state what will happen
> > in
> > this case.
> > --
> > View this message in context:
> > http://www.nabble.com/Slave-interpreters%2C-events-and-atomicity-of-callbacks-tp26031628p
26031628.html
> > Sent from the tcl-core mailing list archive at Nabble.com.
> >
> >
> > ------------------------------------------------------------------------------
> > Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> > is the only developer event you need to attend this year. Jumpstart your
> > developing skills, take BlackBerry mobile applications to market and stay
> > ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> > http://p.sf.net/sfu/devconference
> > _______________________________________________
> > Tcl-Core mailing list
> > Tcl-Core@[...].net
> > https://lists.sourceforge.net/lists/listinfo/tcl-core
> >
>  
>  ------------------------------------------------------------------------------
>  Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>  is the only developer event you need to attend this year. Jumpstart your
>  developing skills, take BlackBerry mobile applications to market and stay 
>  ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>  http://p.sf.net/sfu/devconference
>  _______________________________________________
>  Tcl-Core mailing list
>  Tcl-Core@[...].net
>  https://lists.sourceforge.net/lists/listinfo/tcl-core
>  
>  

-- 
View this message in context: http://www.nabble.com/Slave-interpreters%2C-events-and-atomici
ty-of-callbacks-tp26031628p26034375.html
Sent from the tcl-core mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Tcl-Core mailing list
Tcl-Core@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-core
Thread:
K2k2e6
Mark Janssen
K2k2e6
Alexandre Ferrieux

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved