Hello, (bis)
I try to use SELECT FOR UPDATE, but it seems to be buggy, hum ? Perhaps it's
my algorythm...
My syslock table:
---------------
id integer
used boolean
---------------
Here is the algo:
---------------
boolean Got = false
while Got == false
Start transaction
SELECT * FROM syslock WHERE id=%d AND used='f' FOR UPDATE
if SELECT returns a row
then
UPDATE syslock SET used='t' WHERE id=%d
Commit transaction
Got = true
else
Rollback transaction
continue // yes, active wait ... I'm testing !
end if
end while
Trace "I get the syslock number %d !!"
Do something with the syslock %d which is now reserved
UPDATE syslock SET used='f' WHERE id=%d
---------------
When a lot of threads (well, I tried 20, 5 and 2) used this algo, more than
one thread get the syslock %d at the same time.
What is the problem ?
Thanks
Patrice Espié
--
Le Monde, c'est comme un éléphant
qui va à la pêche