diff options
| author | ruki <[email protected]> | 2024-01-27 12:13:26 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-01-27 12:13:26 +0800 |
| commit | 2727f450c5bdbd5b440de5fb44d4afcb6fcea2eb (patch) | |
| tree | caeddd29ef5e5ed1f0a9b20bdbabf08e09fb37b3 | |
| parent | 77d5bd7344d7942a4d5de1ab590f1536fbcb3ed6 (diff) | |
fix lock name
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/detect/find_program.lua | 7 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/detect/find_programver.lua | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua index a3264cb11..6b8aeb13a 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -279,12 +279,13 @@ function sandbox_lib_detect_find_program.main(name, opt) -- @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(cachekey) + local lockname = cachekey .. name + scheduler.co_lock(lockname) -- attempt to get result from cache first local result = detectcache:get2(cachekey, name) if result ~= nil and not opt.force then - scheduler.co_unlock(cachekey) + scheduler.co_unlock(lockname) return result and result or nil end @@ -317,7 +318,7 @@ function sandbox_lib_detect_find_program.main(name, opt) utils.cprint("checking for %s ... ${color.nothing}${text.nothing}", name) end end - scheduler.co_unlock(cachekey) + scheduler.co_unlock(lockname) return result end diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua b/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua index 855a07479..c8ca91826 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua @@ -63,12 +63,13 @@ function sandbox_lib_detect_find_programver.main(program, opt) -- @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(cachekey) + local lockname = cachekey .. program + scheduler.co_lock(lockname) -- attempt to get result from cache first local result = detectcache:get2(cachekey, program) if result ~= nil and not opt.force then - scheduler.co_unlock(cachekey) + scheduler.co_unlock(lockname) return result and result or nil end @@ -109,7 +110,7 @@ function sandbox_lib_detect_find_programver.main(program, opt) -- save result detectcache:set2(cachekey, program, result and result or false) detectcache:save() - scheduler.co_unlock(cachekey) + scheduler.co_unlock(lockname) return result end |
