[cmake-developers] New command 'file(LOCK_DIRECTORY ...)'
Brad King
brad.king at kitware.com
Mon Oct 6 08:54:24 EDT 2014
On 10/05/2014 04:59 PM, Ruslan Baratov via cmake-developers wrote:
> So it can't be resolved without some low-level management. I'm thinking
> about `file` command sub-option like LOCK_DIRECTORY:
> `file(LOCK_DIRECTORY "/path/to/shared-dir")`. Does it sounds doable?
I think it is a reasonable proposal. However, more design is needed
here, including at least the following items:
* There needs to be a way to define the scope of the lock other than
"until cmake exits". For example, "until current function exits".
* There needs to be a way to explicitly unlock early, or to explicitly
release management of the lock (e.g. to pass to some other process).
* The implementation on Windows needs to be handled carefully.
The "safe" way to delete a file there is to open it with a handle
that is marked as delete-on-close, and then close the handle.
That way the file is eventually deleted even if other processes
currently have it open/locked. I don't know if there is an
equivalent for a directory.
Thanks,
-Brad
More information about the cmake-developers
mailing list