[compiler-rt] e6c2952 - [scudo] Condition variable can be disabled by setting the flag to off (#77532)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 11:03:32 PST 2024


Author: ChiaHungDuan
Date: 2024-01-10T11:03:28-08:00
New Revision: e6c2952eb51a422e17f002d97b0ea467be4d325b

URL: https://github.com/llvm/llvm-project/commit/e6c2952eb51a422e17f002d97b0ea467be4d325b
DIFF: https://github.com/llvm/llvm-project/commit/e6c2952eb51a422e17f002d97b0ea467be4d325b.diff

LOG: [scudo] Condition variable can be disabled by setting the flag to off (#77532)

To enable the condition variable, you have to define both
UseConditionVariable and the ConditionVariableT. Otherwise, it'll be
disabled. However, you may want to disable the condition variable by
setting UseConditionVariable=false, for example, while measuring the
performance and you want to turn it off temporarily. Instead of
requiring the removal of the variable, examining its value makes more
sense.

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/condition_variable.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/condition_variable.h b/compiler-rt/lib/scudo/standalone/condition_variable.h
index 549f6e9f787bad..4afebdc9d04c2c 100644
--- a/compiler-rt/lib/scudo/standalone/condition_variable.h
+++ b/compiler-rt/lib/scudo/standalone/condition_variable.h
@@ -51,7 +51,7 @@ struct ConditionVariableState {
 
 template <typename Config>
 struct ConditionVariableState<Config, decltype(Config::UseConditionVariable)> {
-  static constexpr bool enabled() { return true; }
+  static constexpr bool enabled() { return Config::UseConditionVariable; }
   using ConditionVariableT = typename Config::ConditionVariableT;
 };
 


        


More information about the llvm-commits mailing list