Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

File locking: A client must "lock" a .cacheMap file before accessing it.  Opening a file with write access does not lock it on all platforms, therefore we use the following convention, which all clients must follow: 

  • To lock a file <filename> a client must successfully create an (empty) folder in the file's parent folder and named <filename>.lock.  (Folder creation is atomic and exclusive across platforms.  This lock folder acts as a mutex object.)

...

  •   
  • If the client is successful, it has exclusive access for ten (10) seconds from the time the lock folder is created.

...

  •   
  • When the creation time stamp is older than ten seconds, any client may delete the lock folder and the client which has created the folder is obligated to refrain from accessing <filename> unless it locks the file again.  The time limit prevents stale locks from blocking other clients

...

  • .  
  • If the client cannot obtain a lock within seventy (70) seconds, it should throw an appropriate exception.
  • The client creating the lock should delete the lock folder when it's done accessing <filename>.

 

File Usage Examples

In each example, we have a project in which the File will reside:

...