Skip to content
Tcl Source Code View Ticket
Login

View Ticket

add Tcl_RunMainLoop()

Open1552653fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-09-05 13:19:42
Routine Tcl_SetMainLoop() sets a static variable that can only be 
referenced if you use Tcl_Main().

If you don't want to use Tcl_Main(), there's no way to override 
Tcl_SetMainLoop() so you can catch it if a package calls it (e.g. if Tk gets 
loaded in a script with "package require Tk").

One option would be to add Tcl_GetMainLoop(), but even easier and what 
would presumably always be used would be:

void Tcl_RunMainLoop()
{
   if (mainLoopProc != NULL)
      (*mainLoopProc)();

   mainLoopProc = NULL;
}

Thanks,

[email protected]
dkf Ticket [1552653fff]: 2 changes [History diff]2006-09-05 20:44:14
dgpplain2006-09-05 21:20:18
Logged In: YES 
user_id=80530


Thanks for the suggestion.
If we go this way, it will
have to be as part of at
least a slight bit of re-working
to address the threading
deficiencies of what's there
now.  See 801429.
dgpplain2006-09-05 21:26:03
Logged In: YES 
user_id=80530


I've occasionally pondered
(ab)using the [package] command
to enable:

  package require eventloop

Packages that need an event loop
running to functions could 
include that, and any Tcl_SetMainLoop()
call could [package provide] this 
"package" so it would be known
that an eventloop is on the way.

More to think about...
Log in (anonymous is fine) to add a comment.