summaryrefslogtreecommitdiff
path: root/xmake/modules/lib/detect/features.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-01-25 22:32:40 +0800
committerruki <[email protected]>2024-01-25 12:10:23 +0800
commit039897c33bf0e4066eaae3583d09721f46226a87 (patch)
tree9d8d6b9c79f6c68f26d86fe387a0d0638bbec96f /xmake/modules/lib/detect/features.lua
parentdbb46f95b4b61787857261807a741f8ae34db7f9 (diff)
improve to find_program
Diffstat (limited to 'xmake/modules/lib/detect/features.lua')
-rw-r--r--xmake/modules/lib/detect/features.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/xmake/modules/lib/detect/features.lua b/xmake/modules/lib/detect/features.lua
index 33be29301..7a00b04b4 100644
--- a/xmake/modules/lib/detect/features.lua
+++ b/xmake/modules/lib/detect/features.lua
@@ -57,16 +57,17 @@ function main(name, opt)
_g._RESULTS = _g._RESULTS or {}
local results = _g._RESULTS
+ -- @see https://github.com/xmake-io/xmake/issues/4645
+ -- @note avoid detect the same program in the same time leading to deadlock if running in the coroutine (e.g. ccache)
+ scheduler.co_lock(key)
+
-- get result from the cache first
local result = results[key]
if result ~= nil then
+ scheduler.co_unlock(key)
return result
end
- -- @see https://github.com/xmake-io/xmake/issues/4645
- -- @note avoid detect the same program in the same time leading to deadlock if running in the coroutine (e.g. ccache)
- scheduler.co_lock(key)
-
-- detect.tools.xxx.features(opt)?
local features = import("detect.tools." .. tool.name .. ".features", {try = true})
if features then