OPTIMIST (likely to find the item in the list): Start with a shared lock, and without unlocking, "promote" to an exclusive lock once not found; make sure there is a timer on the attempt to prevent a deadlock, and if the timer goes off then unlock and retry from the top.
PESSIMIST (unlikely to find the item in the list): Use the exclusive lock from the beginning.
In reply to Re^4: File Locking
by Anonymous Monk
in thread File Locking
by turnstep
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |