[cmake-developers] New command 'file(LOCK_DIRECTORY ...)'
Ruslan Baratov
ruslan_baratov at yahoo.com
Fri Oct 31 09:07:02 EDT 2014
Does anybody ready to implement it or you want me to send the patches?
Ruslo
On 29-Oct-14 16:48, Brad King wrote:
> On 10/28/2014 04:28 PM, Ruslan Baratov wrote:
>> What do you think about this:
> Thanks for drafting the signature.
>
>> file(
>> LOCK <path>
>> [DIRECTORY] # if present locked file will be <path>/cmake.lock
>> (instead of <path>)
>> [RELEASE] # do explicit unlock
>> [GUARD <FUNCTION|FILE|PROCESS>] # if not present - set to `GUARD
>> PROCESS` (not used if RELEASE)
>> [RESULT_VARIABLE <variable>] # 0 on success, error message
>> otherwise; if not present - any error is FATAL_ERROR
>> [TIMEOUT <seconds>]
>> # 0 - return immediately if operation failed (try_lock),
>> otherwise timeout (timed_lock);
>> # if not present - lock until success (or error);
>> # not used if RELEASE;
>> )
> That looks good. The TIMEOUT unit can be 'seconds' but it should
> accept a floating point value to get shorter times if possible.
>
>> Boost implementation of file locking mechanism use
>> LockFileEx/UnlockFileEx for windows and fcntl for unix-like platforms.
>> These functions lock file only for current process. When process crashes
>> lock removed by OS automatically.
> Great!
>
>> I've tried (Un)LockFileEx/fcntl on windows (including mingw and cygwin),
>> linux and mac - works fine for me with one exception: cygwin's lock is
>> not visible by win32's lock. I.e. you can synchronize multiple cygwin
>> processes and multiple windows "normal" processes, but you can't mix them.
> Thanks for testing. The windows/cygwin mixing limitation is acceptable
> IMO.
>
> Thanks,
> -Brad
>
More information about the cmake-developers
mailing list