repo.or.cz
/
jimtcl.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
utf8: Update UnicodeData.txt to 9.0.0
[jimtcl.git]
/
examples
/
timedread.tcl
blob
cb4c9aa1889fb6b9c491a39cfbeae5e944c09a83
1
# Tests that SIGALRM can interrupt read
2
set
f
[
open
"/dev/urandom"
r
]
3
4
set
count
0
5
set error
NONE
6
7
signal handle SIGALRM
8
catch
-signal
{
9
alarm
0.5
10
while
{
1
} {
11
incr
count
[
string
bytelength
[
read
$f
100
]]
12
}
13
alarm
0
14
signal
default
SIGALRM
15
}
error
16
17
puts
"Read
$count
bytes in 0.5 seconds: Got
$error
"
18
19
$f
close