Re: Serial Port and asynchronous event help need
- From: Uwe Klein <uwe_klein_habertwedt@xxxxxxxxxxx>
- Date: Wed, 09 Dec 2009 23:07:40 +0100
CKL wrote:
We see that I have to use at minimum 3 vwaits, meaning that I don't
know how to do this with "ONE" as you proposed Dave
I assume you will use the package expect
you write a
proc repeat {delay script} {
if 1 $script
after $delay repeat $delay $script
}
repeat 5000 {dev_trigger ...}
proc dev_trigger ... {
....
incr ::globalstate(typeA,message,cnt)
lappend ::globalstate(eventq) outgoing
after $trigger_timeout lappend ::globalstate(eventq) outgoing_timeout
}
# ok 1 vwait fixed
exp_background \
$typeamessage {
do_typea_Thing
incr ::globalstate(typeA,message,cnt)
lappend ::globalstate(eventq) typeA
} $typebmessage {
do_TypeB_Thing
incr ::globalstate(typeB,message,cnt)
lappend ::globalstate(eventq) typeB
} eof {
puts stderr "aijeehh, you've killed it"
}
any GUI interaction changes something in ::globalstate
# ok 2. vwait fixed
while true {
vwait ::globalstate ;# this is the place were all the background stuff
;# is done as events roll in.
set currq ::globalstate(eventq) ; set ::globalstate(incoming) {}
foreach item $currq {
switch -- $item \
... {
} exit {
# cleanup and leave programm
}
}
}
# ok vwait 3 is actually done
There are certainly other ways to do it
but if you have one single item that is event triggered ( gui here )
the remaining functionality should heed that and work to similar
priciples.
uwe
.
- Follow-Ups:
- References:
- Serial Port and asynchronous event help need
- From: CKL
- Re: Serial Port and asynchronous event help need
- From: dave.joubert@xxxxxxxxxxxxxx
- Re: Serial Port and asynchronous event help need
- From: CKL
- Re: Serial Port and asynchronous event help need
- From: Uwe Klein
- Re: Serial Port and asynchronous event help need
- From: dave.joubert@xxxxxxxxxxxxxx
- Re: Serial Port and asynchronous event help need
- From: CKL
- Serial Port and asynchronous event help need
- Prev by Date: Re: Serial Port and asynchronous event help need
- Next by Date: Re: rsync, ssh, and tcl
- Previous by thread: Re: Serial Port and asynchronous event help need
- Next by thread: Re: Serial Port and asynchronous event help need
- Index(es):
Relevant Pages
|