aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobo <tobo@yandex-team.com>2022-09-22 10:28:48 +0300
committertobo <tobo@yandex-team.com>2022-09-22 10:28:48 +0300
commit4728a5b422fcd40631a478251e016178ca74e5fb (patch)
tree3f1ae718470c3c72a6f1b9ed128dd9ee7d412314
parentf3c0db3124e7960338b0514c431553c8726670d4 (diff)
downloadydb-4728a5b422fcd40631a478251e016178ca74e5fb.tar.gz
add comment for TAdaptiveLock
https://clubs.at.yandex-team.ru/arcadia/8450/8489#reply-arcadia-8489
-rw-r--r--util/system/spinlock.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/system/spinlock.h b/util/system/spinlock.h
index 3fbe8a6441..87c1e2e187 100644
--- a/util/system/spinlock.h
+++ b/util/system/spinlock.h
@@ -82,6 +82,14 @@ public:
}
};
+/**
+ * TAdaptiveLock almost always should be used instead of TSpinLock.
+ * It also should be used instead of TMutex for short-term locks.
+ * This usually means that the locked code should not use syscalls,
+ * since almost every syscall:
+ * - might run unpredictably long and the waiting thread will waste a lot of CPU
+ * - takes considerable amount of time, so you should not care about the mutex performance
+ */
class TAdaptiveLock: public TSpinLockBase {
public:
using TSpinLockBase::TSpinLockBase;