aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/deprecated/galloc/hack.cpp
diff options
context:
space:
mode:
authorvitalyisaev <vitalyisaev@ydb.tech>2023-11-30 13:26:22 +0300
committervitalyisaev <vitalyisaev@ydb.tech>2023-11-30 15:44:45 +0300
commit0a98fece5a9b54f16afeb3a94b3eb3105e9c3962 (patch)
tree291d72dbd7e9865399f668c84d11ed86fb190bbf /contrib/deprecated/galloc/hack.cpp
parentcb2c8d75065e5b3c47094067cb4aa407d4813298 (diff)
downloadydb-0a98fece5a9b54f16afeb3a94b3eb3105e9c3962.tar.gz
YQ Connector:Use docker-compose in integrational tests
Diffstat (limited to 'contrib/deprecated/galloc/hack.cpp')
-rw-r--r--contrib/deprecated/galloc/hack.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/contrib/deprecated/galloc/hack.cpp b/contrib/deprecated/galloc/hack.cpp
new file mode 100644
index 0000000000..3ba36dacea
--- /dev/null
+++ b/contrib/deprecated/galloc/hack.cpp
@@ -0,0 +1,20 @@
+#include "hack.h"
+
+#include <library/cpp/deprecated/atomic/atomic.h>
+#include <util/system/spin_wait.h>
+
+#include "spinlock.h"
+
+void SPIN_L(spinlock_t* l) {
+ if (!AtomicTryLock(l)) {
+ TSpinWait sw;
+
+ while (!AtomicTryAndTryLock(l)) {
+ sw.Sleep();
+ }
+ }
+}
+
+void SPIN_U(spinlock_t* l) {
+ AtomicUnlock(l);
+}