ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcl-threads
tcl-threads
[Tcl-Threads] tsv locking
by yahalom other posts by this author
Dec 16 2003 6:25AM messages near this date
RE: [Tcl-Threads] Thread-safe Tcl Extensions | [Tcl-Threads] Is it possible to call the TCL interpreter from a C++ application, in a way that they will run in the same data block?
Hello

I tried to use the tsv::lock but it seems that the locking does not happen.
this is a test script. I would accept that only the first thread will be
able to enter the while loop but it seems that both thread enter it.
#

#
package require Thread
for {set j 0} {$j<2} {incr j} {
set threadId [thread::create]
thread::send -async $threadId {
	set i 0
	tsv::lock lock {
		while {1} {
		tsv::set lock i $i
		puts "[thread::id]: [tsv::get lock i]"
		after 1000
		incr i
		}
	}
}
}

vwait forever
#
#

what am I doing wrong?

Thanks

Yahalom Emet
Software Developer
Xor Technologies Ltd.

Tel: +972 (0)4-6619164
E-mail: yahalomE@[...].com
Web: http://www.xortechnologies.com



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Tcl-Threads mailing list
Tcl-Threads@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-threads

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved