Tcl Source Code

Check-in [029b9c4847]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use the Thread package instead of the [testthread] command to do thread-enabled testing of the http package.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dgp-thread-leaks
Files: files | file ages | folders
SHA1: 029b9c4847ca60230e0745cd7b9191b8a4c503df
User & Date: dgp 2011-08-30 21:27:06
Original Comment: Use the Thread package instead of the [testthread] command to do thread-enabled testing of the http package.
Context
2011-08-31
17:49
Detect trailers after Nan, Inf, etc. check-in: a132259d0c user: ferrieux tags: dgp-thread-leaks, bug-3401704
2011-08-30
21:27
Use the Thread package instead of the [testthread] command to do thread-enabled testing of the http... Closed-Leaf check-in: 029b9c4847 user: dgp tags: dgp-thread-leaks
16:20
Prevent leak of interps when using the [testthread exit] command. check-in: 3fc64e5692 user: dgp tags: dgp-thread-leaks
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/http.test.

47
48
49
50
51
52
53

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
if {![file exists $httpdFile]} {
    makeFile "" $httpdFile
    file delete $httpdFile
    file copy $origFile $httpdFile
    set removeHttpd 1
}


if {[info commands testthread] == "testthread" && [file exists $httpdFile]} {
    set httpthread [testthread create "
	source [list $httpdFile]
	testthread wait
    "]
    testthread send $httpthread [list set port $port]
    testthread send $httpthread [list set bindata $bindata]
    testthread send $httpthread {httpd_init $port}
    puts "Running httpd in thread $httpthread"
} else {
    if {![file exists $httpdFile]} {
	puts "Cannot read $httpdFile script, http test skipped"
	unset port
	return
    }







>
|
|
|
<
<
|
|
|







47
48
49
50
51
52
53
54
55
56
57


58
59
60
61
62
63
64
65
66
67
if {![file exists $httpdFile]} {
    makeFile "" $httpdFile
    file delete $httpdFile
    file copy $origFile $httpdFile
    set removeHttpd 1
}

catch {package require Thread 2.6}
if {[catch {package present Thread}] == 0 && [file exists $httpdFile]} {
    set httpthread [thread::create -preserved]
    thread::send $httpthread [list source $httpdFile]


    thread::send $httpthread [list set port $port]
    thread::send $httpthread [list set bindata $bindata]
    thread::send $httpthread {httpd_init $port}
    puts "Running httpd in thread $httpthread"
} else {
    if {![file exists $httpdFile]} {
	puts "Cannot read $httpdFile script, http test skipped"
	unset port
	return
    }
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602

# cleanup
catch {unset url}
catch {unset badurl}
catch {unset port}
catch {unset data}
if {[info exists httpthread]} {
    testthread send -async $httpthread {
	testthread exit
    }
} else {
    close $listen
}

if {[info exists removeHttpd]} {
    removeFile $httpdFile
}







|
<
<







585
586
587
588
589
590
591
592


593
594
595
596
597
598
599

# cleanup
catch {unset url}
catch {unset badurl}
catch {unset port}
catch {unset data}
if {[info exists httpthread]} {
    thread::release $httpthread


} else {
    close $listen
}

if {[info exists removeHttpd]} {
    removeFile $httpdFile
}