MantisBT - CMake
View Issue Details
0014077CMakeCMakepublic2013-04-12 13:402016-06-10 14:31
Jean-Christophe Fillion-Robin 
Kitware Robot 
normalfeaturehave not tried
closedmoved 
CMake 2.8.10.2 
 
0014077: Teach RESOURCE_LOCK to use file
See http://www.cmake.org/cmake/help/v2.8.10/cmake.html#prop_test:RESOURCE_LOCK [^]

By using file, it would then be easy to ensure resources are lock across different ctest.

This would be particularly useful when setting up multiple Dashboard or CDash@Home client on the same workstation.
No tags attached.
Issue History
2013-04-12 13:40Jean-Christophe Fillion-RobinNew Issue
2013-04-12 14:40Jean-Christophe Fillion-RobinNote Added: 0032820
2013-04-12 15:10Brad KingNote Added: 0032821
2013-04-12 15:10Brad KingStatusnew => backlog
2016-06-10 14:28Kitware RobotNote Added: 0042266
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0032820)
Jean-Christophe Fillion-Robin   
2013-04-12 14:40   
The interesting code snippets are:
  cmCTestMultiProcessHandler::LockResources [1]
  cmCTestMultiProcessHandler::UnlockResources [1]
  Check if resource if locked in "cmCTestMultiProcessHandler::StartTest" [2]

Possible implementation
=======================

  1)Add an additional property named "RESOURCE_LOCK_DIRECTORY"
        and/or
    Add a global variable named "CTEST_RESOURCE_LOCK_DIRECTORY that could be set in CTest script.

  2) If "RESOURCE_LOCK_DIRECTORY" is set, each time a resources is locked/unlocked, associated file would be created/removed from that directory.

  3) The code checking if a resource is locked could be factored out into a function named "CheckLockedResources" [2]

  4) Within this new "CheckLockedResources(int)" function, in addition to check if a resource is in the "LockedResources" vector, the file system could be verified for presence of a lock file.

[1] https://github.com/Kitware/CMake/blob/324780697c5020a027efdc24bd9cc2fc926a3546/Source/CTest/cmCTestMultiProcessHandler.cxx#L149-168 [^]

[2] https://github.com/Kitware/CMake/blob/324780697c5020a027efdc24bd9cc2fc926a3546/Source/CTest/cmCTestMultiProcessHandler.cxx#L197-206 [^]
(0032821)
Brad King   
2013-04-12 15:10   
Some operating systems may provide dedicated system-wide lock APIs that may be worth investigating.

For lock files, creation will need to be done with CreateFile's CREATE_NEW on windows and open's O_CREAT|O_EXCL on POSIX to ensure atomic locks. Alternatively I think mkdir() may work if we use subdirectories as locks.
(0042266)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.