This patch uses the resource's own KABC::Lock to lock the cache file, which inhibits the file_copy operation that causes the error.  The resource detects its cache is locked after having loaded the cache, but before refreshing the cache. 
This patch uses the resource's own KABC::Lock to lock the cache file, which inhibits the file_copy operation that causes the error.  The resource detects its cache is locked after having loaded the cache, but before refreshing the cache. 

The result of adding this lock is that if two processes are simultaneously reloading the resource, the winner will first load the cached version (call it C-1) and then load C0 after fetching it.  The loser will load C-1, encounter the lock and stop.  On the next iteration, Winner gets C1 and Loser gets C0. 

So the result of the lockstep is that loser is at most out of date by one version of the resource.   A better synchronisation would be if we had distributed locks so that Loser is notified when Winner releases its lock and then loads the fresh cache file. 


svn path=/branches/KDE/3.5/kdepim/; revision=627092

lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi