[cmake-developers] New command 'file(LOCK_DIRECTORY ...)'
Brad King
brad.king at kitware.com
Wed Oct 8 08:45:00 EDT 2014
On 10/08/2014 07:52 AM, Ruslan Baratov wrote:
> Okay :) I just not sure that I understand "to pass to some other
> process" goal correctly.
That was just an example of why one might want to drop management
of the lock by CMake without actually unlocking it. Perhaps the
code is starting a daemon and passes off responsibility for the
unlock side to the daemon process.
> * we just need to `unlock` file so the other instance will use it:
> file(UNLOCK_FILE "/path/to/shared/file")
> # now anybody can do the lock
Yes. We also need the locking API to return information about
whether we really acquired the lock.
> * we need other process to "inherit" the lock (what for?), i.e. move
> ownership (?):
> file(LOCK_FILE "/path/to/shared/file")
> execute_process(${CMAKE_COMMAND} --take-ownership "/path/to/shared/file"
> ...)
> # unlocked by execute_process
I think all we need there is a way to ask CMake to take over
responsibility for a lock that it did not originally create.
It can also be in the file() command.
Thanks,
-Brad
More information about the cmake-developers
mailing list