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 Mark Janssen other posts by this author
Oct 23 2009 12:47PM messages near this date
[TCLCORE] Slave interpreters, events and atomicity of callbacks | Re: [TCLCORE] Slave interpreters, events and atomicity of callbacks
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-atomi
city-of-callbacks-tp26031628p26031628.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
Thread:
K2k2e6
Mark Janssen
K2k2e6
Alexandre Ferrieux

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