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


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to