Hi everybody!
I met with a feature of VFP! I don't know if it is knonw for everyone, but it was suprising for me.
use mytable alias myalias1 in 0
use mytable alias myalias2 again in 0
flock("myalias1") && it locks MYTABLE
flock("myalias2") && it also locks MYTABLE
unlock in myalias1 && it removes lock from MYTABLE
&& -> myalias2 is NOT LOCKOED anylonger
So, locking a table in an alias lock the table phisically.
Every alias, referencing to this table can use this table as a locked table, but can FLOCK()s it.
UNLOCKing any alias, referencing to this table will remove the locking from that table. (it means all alias referencing to this table lose locked state of this table)
I thought that VFP has a lock count of every table, and only remove the lock from a table, if lock count is 0 again (flock increments, unlock decrement the table lock counter). But it is not ...
It is very similar to that behaviour, as use command with noupdate clause. If the first use of a table contains noupdate clause, any subsequent use of this table will open in read only mode thais table. It is independent from datasessions. (I read it in UT, and it gave me the idea testing this lock behaviour.)
I read in dev guide of VFP, that VFP use only one file handle for all aliases of a certain table. I guess this is the explanation of this behaviour.
So, any comment?
BB
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement