• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

lock implements problem...

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thx Satish, you are right. I should use while to replace if condition.
B/R

Barry
 
I need a new interior decorator. This tiny ad just painted every room in my house purple.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic