For Programmers: Free Programming Magazines  


Home > Archive > Tcl > May 2004 > Tcl_AsyncCreate/Tcl_AsyncMark question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Tcl_AsyncCreate/Tcl_AsyncMark question
Brice

2004-05-15, 1:31 am

Hello guys,

Sorry to bother you with my problem and sorry if this question was already
posted a zillion times. I am newbie to this group.

Here is my problem and my question:

I am mixing real time network eventsinto a TCL/TK application. For this I
use the commands Tcl_AsyncCreate/Tcl_AsyncMark to trigger a call in the C++
library from the TCL loop. In this C++ routine, I save the state of the
interpreter as specified in the documentation and I call the evaluation of a
script according to this event. Now in this script I update some data
variable of graphical TK components.

Here is the fondamental question: Am I called in the C++ lib when I am
outside a procedure in my main TCL loop or could I be interrupted while I am
inside and therefore execute another part of my script as specified in my
C++ layer ?

I am getting random crashes and I suspect that this is what's happen from
what I experienced.

Thank you in advance.

Bruce.


Don Libes

2004-05-17, 11:42 am

"Brice" <brice@acedsl.com> writes:

> Hello guys,
>
> Sorry to bother you with my problem and sorry if this question was already
> posted a zillion times. I am newbie to this group.
>
> Here is my problem and my question:
>
> I am mixing real time network eventsinto a TCL/TK application. For this I
> use the commands Tcl_AsyncCreate/Tcl_AsyncMark to trigger a call in the C++
> library from the TCL loop. In this C++ routine, I save the state of the
> interpreter as specified in the documentation and I call the evaluation of a
> script according to this event. Now in this script I update some data
> variable of graphical TK components.
>
> Here is the fondamental question: Am I called in the C++ lib when I am
> outside a procedure in my main TCL loop or could I be interrupted while I am
> inside and therefore execute another part of my script as specified in my
> C++ layer ?
>
> I am getting random crashes and I suspect that this is what's happen from
> what I experienced.
>
> Thank you in advance.
>
> Bruce.


Are you referring to the WARNING section of the man page? It sounds
like it. I would encourage you to avoid this approach (which is
really hard to get right) and just let Tcl call back your async script
when Tcl decides that it is safe to do so.

Don

David Gravereaux

2004-05-17, 3:33 pm

Don Libes <libes@nist.gov> wrote:

>"Brice" <brice@acedsl.com> writes:
>
>
>Are you referring to the WARNING section of the man page? It sounds
>like it. I would encourage you to avoid this approach (which is
>really hard to get right) and just let Tcl call back your async script
>when Tcl decides that it is safe to do so.
>
>Don


I've found the best way to be safe from a Tcl_AsyncProc is to just post an
event from there with Tcl_QueueEvent.
--
David Gravereaux <davygrvy@pobox.com>
[species: human; planet: earth,milkyway(western spiral arm),alpha sector]
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com