Tcl Source Code

Artifact [4ae5c15ffc]
Login

Artifact 4ae5c15ffc9da3a10e5e873441efd01593c1924a056c5db09b5f813b9c1c5e18:

Attachment "c35e347c6f-encoding-user-race.tcl" to ticket [c35e347c6f] added by serhiy.storchaka 2026-10-18 21:43:18.
# Several threads calling [encoding user] at the same time.
# Crashes on OpenBSD (double free in setlocale()).
package require Thread
set threads {}
for {set i 0} {$i < 8} {incr i} {
    lappend threads [thread::create -joinable {
	for {set j 0} {$j < 20000} {incr j} {
	    encoding user
	}
    }]
}
foreach t $threads {
    thread::join $t
}
puts ok