vwait doesn't return after setting TCL_SetVar from a thread
- From: "zivh@xxxxxxxxx" <zivAndmayan@xxxxxxxxx>
- Date: 26 Apr 2007 00:36:06 -0700
Hi All,
i'm a bit confused about the vwait operation.
from what i read so far when doing a TCL_SetVar the on the vairable
the vwait is waiting on the vwait should run.
i changing the variable value using the TCL_SetVar from a thread i
have created.
i'm using windows system and tcl 8.4.1.4 (activestate compilation)
here is the C code (loaded from Dll):
//the thread code
DWORD WINAPI TestProc(ClientData CD)
{
Tcl_Interp * pInterp;
pInterp = (Tcl_Interp* ) CD;
Sleep(20000); //wait 20 sec before writing it
printf("var value now is %s
\n",Tcl_GetVarpInterp,"testEvent",TCL_GLOBAL_ONLY));
printf("changing the variable - see if effecting the vwait\n");
Tcl_SetVar(pInterp,"testEvent","changed succesfully",TCL_GLOBAL_ONLY);
printf("done setting it - thread is being terminated\n");
fflush(stdout);
return 0;
}
//the init function that runs when dll is being loaded
DLLEXPORT int Tcleventdemo_Init(Tcl_Interp *pInterp)
{
ClientData CD = (void *) pInterp;
printf("in DLL init function\n");
Tcl_SetVar(pInterp,"testEvent","init",TCL_GLOBAL_ONLY);
testThread = CreateThread(NULL,
0,
TestProc,
CD,
0,
NULL);
printf("thread was created - exiting\n");
fflush(stdout);
return TCL_OK;
}
//and the relevant Tcl code:
load ./Debug/TclEventDemo.dll
global testEvent
puts "test Env value is: $testEvent"
puts "before vwait"
vwait testEvent
puts "new test Env value - $testEvent"
after 10000
thanks for the help
.
- Follow-Ups:
- Re: vwait doesn't return after setting TCL_SetVar from a thread
- From: David Gravereaux
- Re: vwait doesn't return after setting TCL_SetVar from a thread
- Prev by Date: Re: negative indices in Tk?
- Next by Date: Re: how to suppress set command output ??
- Previous by thread: Command history by cursor key in Linux tclsh
- Next by thread: Re: vwait doesn't return after setting TCL_SetVar from a thread
- Index(es):
Relevant Pages
|