summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-04-04 17:31:59 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-04-04 17:31:59 (GMT)
commitf645033318ef3df0653babe269de18aebcca34f1 (patch)
tree5d756d4272363107ce00a45a57317b390c1299e4 /doc
parent543a9cb0f2306de1770f95ba67834ae3409ca065 (diff)
downloadtcl-f645033318ef3df0653babe269de18aebcca34f1.zip
tcl-f645033318ef3df0653babe269de18aebcca34f1.tar.gz
tcl-f645033318ef3df0653babe269de18aebcca34f1.tar.bz2
Fix [Bug 1910136].
Diffstat (limited to 'doc')
-rw-r--r--doc/vwait.n32
1 files changed, 27 insertions, 5 deletions
diff --git a/doc/vwait.n b/doc/vwait.n
index 89796c6..fb62fdf 100644
--- a/doc/vwait.n
+++ b/doc/vwait.n
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: vwait.n,v 1.8 2008/10/17 10:22:25 dkf Exp $
+'\" RCS: @(#) $Id: vwait.n,v 1.9 2009/04/04 17:32:00 dkf Exp $
'\"
.so man.macros
.TH vwait n 8.0 Tcl "Tcl Built-In Commands"
@@ -19,12 +19,12 @@ vwait \- Process events until a variable is written
.PP
This command enters the Tcl event loop to process events, blocking
the application if no events are ready. It continues processing
-events until some event handler sets the value of variable
+events until some event handler sets the value of the global variable
\fIvarName\fR. Once \fIvarName\fR has been set, the \fBvwait\fR
command will return as soon as the event handler that modified
-\fIvarName\fR completes. \fIvarName\fR must be globally scoped
-(either with a call to \fBglobal\fR for the \fIvarName\fR, or with
-the full namespace path specification).
+\fIvarName\fR completes. The \fIvarName\fR argument is always interpreted as
+a variable name with respect to the global namespace, but can refer to any
+namespace's variables if the fully-qualified name is given.
.PP
In some cases the \fBvwait\fR command may not return immediately
after \fIvarName\fR is set. This can happen if the event handler
@@ -75,7 +75,29 @@ switch $state {
}
}
.CE
+.PP
+A command that will wait for some time delay by waiting for a namespace
+variable to be set. Includes an interlock to prevent nested waits.
+.PP
+.CS
+namespace eval example {
+ variable v done
+ proc wait {delay} {
+ variable v
+ if {$v ne "waiting"} {
+ set v waiting
+ after $delay [namespace code {set v done}]
+ \fBvwait\fR [namespace which -variable v]
+ }
+ return $v
+ }
+}
+.CE
.SH "SEE ALSO"
global(n), update(n)
.SH KEYWORDS
event, variable, wait
+'\" Local Variables:
+'\" mode: nroff
+'\" fill-column: 78
+'\" End: