TIP #434: Specify Event Sources for 'vwait'


TIP:434
Title:Specify Event Sources for 'vwait'
Version:$Revision: 1.1 $
Author:Jos Decoster <jos dot decoster at gmail dot com>
State:Draft
Type:Project
Tcl-Version:8.6
Vote:Pending
Created:Thursday, 26 February 2015

Abstract

This TIP proposes to extend the vwait Tcl command so the event sources can be specified, as is possible with the Tcl_DoOneEvent C command.

Rationale

In some situations it can be required not to wait for specific event sources or to wait for specific events sources only. You might want the program to only react on timer events, and not on file or window events. You can write your own version of the Tcl_VwaitObjCmd command in C, and call Tcl_DoOneEvent with the flags you need. Making it possible to specify the event sources, i.e. the arguments for the call to Tcl_DoOneEvent within Tcl_VwaitObjCmd, from the Tcl vwait command would make this functionality available from the Tcl lebvel.

Specification

This document proposes to add optional arguments to the vwait command. If these arguments are not specified, the current event source TCL_ALL_EVENTS will be used. If the optinal arguments are specified, they are the event sources to be passed to Tcl_DoOneEvent within Tcl_VwaitObjCmd. The flags set with the optinal arguments will be or-ed. Possible flags are corresponding to the flags for the Tcl_DoOneEvent command:

Example: wait until variable a is written and only allow timer events to be processed:

 vwait a -timer

Alternatives

A possible alternative is to add support for a -events <event_list> argument.

A -dont_wait argument is not added, a call to update will have the same effect.

Compatibility

No incompatibilities are introduced.

Reference Implementation

A reference implementation is available.

Copyright

This document has been placed in the public domain.


Powered by Tcl[Index] [History] [Edit] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]

TIP AutoGenerator - written by Donal K. Fellows