diff options
author | tobo <tobo@yandex-team.com> | 2022-09-22 10:28:48 +0300 |
---|---|---|
committer | tobo <tobo@yandex-team.com> | 2022-09-22 10:28:48 +0300 |
commit | 4728a5b422fcd40631a478251e016178ca74e5fb (patch) | |
tree | 3f1ae718470c3c72a6f1b9ed128dd9ee7d412314 | |
parent | f3c0db3124e7960338b0514c431553c8726670d4 (diff) | |
download | ydb-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.h | 8 |
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; |