Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

lock implements problem...

 
Barry Tsai
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
when i try my lock code, the following condition was happened,
Thread-0 running..
Thread-0 lock rec.1
Thread-1 running..
Thread-2 running..
Thread-1 rec.1 had be lock!!
Thread-2 rec.1 had be lock!!
Thread-0 rec.1 had be unlock!!
...
Thread-1 & Thread-2 lock the rec.1 in the same time. why??
I don't know why this was happened??

The following is my code...


B/R

Barry
 
Satish Avadhanam
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Barry


You sure its an "if"? If its an "if" condition it checks it and depending on either true or false it comes out of condition. Thread WILL NOT WAIT until record is unlocked.

It should not be a condition, but a loop which waits until record is locked. So you might want to try it using "while".

Good Luck
[ July 12, 2004: Message edited by: Satish Avadhanam ]
 
Barry Tsai
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thx Satish, you are right. I should use while to replace if condition.
B/R

Barry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic