File: uevent_onidle.tcl

package info (click to toggle)
tcllib 2.0%2Bdfsg-4
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 83,572 kB
  • sloc: tcl: 306,798; ansic: 14,272; sh: 3,035; xml: 1,766; yacc: 1,157; pascal: 881; makefile: 124; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (51 lines) | stat: -rw-r--r-- 1,040 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
## -*- tcl -*-
# ### ### ### ######### ######### #########

# ### ### ### ######### ######### #########
## Requisites

package require Tcl 8.5 9 ; #
package require snit    ; # 

# ### ### ### ######### ######### #########
##

snit::type uevent::onidle {
    # ### ### ### ######### ######### #########
    ## API 

    constructor {cmd} {
	set mycmd $cmd
	return
    }

    method request {} {
	if {$myhasrequest} return
	after idle [mymethod RunAction]
	set myhasrequest 1
	return
    }

    # ### ### ### ######### ######### #########
    ## Internal commands

    method RunAction {} {
	set myhasrequest 0
	uplevel \#0 $mycmd
	return
    }

    # ### ### ### ######### ######### #########
    ## State

    variable mycmd        {} ; # Command prefix of the action to perform
    variable myhasrequest 0  ; # Boolean flag, set when the action has
    #                        ; # been requested

    # ### ### ### ######### ######### #########
}

# ### ### ### ######### ######### #########
## Ready

package provide uevent::onidle 0.2