Re: thread::mutex lock problem, a bug?



Hi Zoran,

I tried "after 1", "after 1000", printouts from one thread still
dominates 100%.

I even changed my code to :

#================ code starts======================
thread::create {
puts "Thread [thread::id] is up"

set state_mutex [tsv::get MUTEX STATE]

proc test_mutex { } {
puts "State is ready"
thread::mutex lock [tsv::get MUTEX STATE]

tsv::set STATUS STATE ready

catch {thread::mutex unlock [tsv::get MUTEX STATE]}

#after 1000
after idle [list after 0 test_mutex]
}

test_mutex

thread::wait

}

#================== code ends ==========================

It won't have any difference. Would you please tell my how my posted
test program runs in your tclsh shell?

I looked at the source code,
the code do not check the case of
case w_DESTROY:
and PutMutex(mutexPtr) was moved out of while loop because of the
redundancy.

Is this piece of code is equivalent to last version?
Thank you.

.



Relevant Pages