aboutsummaryrefslogtreecommitdiffstats
path: root/util/system
diff options
context:
space:
mode:
authordmasloff <dmasloff@yandex-team.com>2024-08-17 23:33:42 +0300
committerdmasloff <dmasloff@yandex-team.com>2024-08-17 23:43:45 +0300
commit69340f4614e853b9319df4b454ab7497711ee3cd (patch)
tree9902a3e2f58fe0bd9a157e7b51ad1cc52efa5744 /util/system
parenta905b53ec410defd5d2c40031ef8b34bb50a29f8 (diff)
downloadydb-69340f4614e853b9319df4b454ab7497711ee3cd.tar.gz
Set SpacesInLineCommentPrefix to 1 in /util
Set SpacesInLineCommentPrefix to 1 in /util 3853f9ec5143722c1bebd8dc0ffc9b61a6c17657
Diffstat (limited to 'util/system')
-rw-r--r--util/system/backtrace.cpp2
-rw-r--r--util/system/backtrace_ut.cpp2
-rw-r--r--util/system/byteorder.h4
-rw-r--r--util/system/compat.h4
-rw-r--r--util/system/compiler.h2
-rw-r--r--util/system/condvar.cpp2
-rw-r--r--util/system/condvar.h2
-rw-r--r--util/system/cpu_id_ut.cpp2
-rw-r--r--util/system/datetime.h2
-rw-r--r--util/system/defaults.c2
-rw-r--r--util/system/demangle_impl.h2
-rw-r--r--util/system/event.cpp2
-rw-r--r--util/system/event.h2
-rw-r--r--util/system/file.cpp6
-rw-r--r--util/system/file.h24
-rw-r--r--util/system/filemap.cpp2
-rw-r--r--util/system/filemap_ut.cpp4
-rw-r--r--util/system/fs.cpp2
-rw-r--r--util/system/fs_ut.cpp18
-rw-r--r--util/system/fs_win.cpp4
-rw-r--r--util/system/fstat_ut.cpp2
-rw-r--r--util/system/guard.h2
-rw-r--r--util/system/info.cpp2
-rw-r--r--util/system/mem_info.cpp2
-rw-r--r--util/system/mlock.h8
-rw-r--r--util/system/mutex.h2
-rw-r--r--util/system/pipe.h2
-rw-r--r--util/system/rwlock.cpp2
-rw-r--r--util/system/sem.cpp12
-rw-r--r--util/system/sem.h12
-rw-r--r--util/system/shmat.cpp20
-rw-r--r--util/system/spin_wait.cpp2
-rw-r--r--util/system/thread.cpp6
-rw-r--r--util/system/tls.cpp2
-rw-r--r--util/system/tls.h14
35 files changed, 90 insertions, 90 deletions
diff --git a/util/system/backtrace.cpp b/util/system/backtrace.cpp
index f8d37e8443..8cc93cd3ce 100644
--- a/util/system/backtrace.cpp
+++ b/util/system/backtrace.cpp
@@ -17,7 +17,7 @@
#endif
#if defined(_bionic_)
-//TODO
+// TODO
#else
#if !defined(HAVE_BACKTRACE) && defined(_cygwin_)
#define CaptureStackBackTrace RtlCaptureStackBackTrace
diff --git a/util/system/backtrace_ut.cpp b/util/system/backtrace_ut.cpp
index 9b5ead71bc..b2de5e3957 100644
--- a/util/system/backtrace_ut.cpp
+++ b/util/system/backtrace_ut.cpp
@@ -56,7 +56,7 @@ class TBackTraceTest: public TTestBase {
}
void TestBackTrace() {
- //PrintBackTrace();
+ // PrintBackTrace();
void* buf1[100];
size_t ret1;
diff --git a/util/system/byteorder.h b/util/system/byteorder.h
index 94b9fea515..d408b2a1a4 100644
--- a/util/system/byteorder.h
+++ b/util/system/byteorder.h
@@ -2,7 +2,7 @@
#include "defaults.h"
-//#define USE_GENERIC_ENDIAN_CVT
+// #define USE_GENERIC_ENDIAN_CVT
#if defined(_linux_) && !defined(USE_GENERIC_ENDIAN_CVT)
#include <byteswap.h>
@@ -66,7 +66,7 @@ inline ui64 SwapBytes64(ui64 val) noexcept {
}
#endif
-//for convenience
+// for convenience
static inline ui8 SwapBytes8(ui8 v) noexcept {
return v;
}
diff --git a/util/system/compat.h b/util/system/compat.h
index 437e287497..119b3a2d5f 100644
--- a/util/system/compat.h
+++ b/util/system/compat.h
@@ -24,8 +24,8 @@ extern "C" {
#define SIGQUIT SIGBREAK // instead of 3
#define SIGKILL SIGTERM // instead of 9
- #define SIGPIPE 13 //will not receive under win?
- #define SIGALRM 14 //will not receive under win?
+ #define SIGPIPE 13 // will not receive under win?
+ #define SIGALRM 14 // will not receive under win?
#endif
#if defined(__FreeBSD__) || defined(_darwin_)
diff --git a/util/system/compiler.h b/util/system/compiler.h
index a076c0308c..0c730eae4d 100644
--- a/util/system/compiler.h
+++ b/util/system/compiler.h
@@ -132,7 +132,7 @@
#endif
#endif
-//to cheat compiler about strict aliasing or similar problems
+// to cheat compiler about strict aliasing or similar problems
#if defined(__GNUC__)
#define Y_FAKE_READ(X) \
do { \
diff --git a/util/system/condvar.cpp b/util/system/condvar.cpp
index b4d748e4e9..9bc8fdd060 100644
--- a/util/system/condvar.cpp
+++ b/util/system/condvar.cpp
@@ -39,7 +39,7 @@ namespace {
inline void BroadCast() noexcept {
with_lock (Lock_) {
- //TODO
+ // TODO
while (!Events_.Empty()) {
Events_.PopFront()->Signal();
}
diff --git a/util/system/condvar.h b/util/system/condvar.h
index 569162717c..a030528353 100644
--- a/util/system/condvar.h
+++ b/util/system/condvar.h
@@ -55,7 +55,7 @@ public:
WaitD(m, TInstant::Max(), std::move(pred));
}
- //deprecated
+ // deprecated
inline void Wait(TMutex& m) noexcept {
WaitI(m);
}
diff --git a/util/system/cpu_id_ut.cpp b/util/system/cpu_id_ut.cpp
index 68f1f8aac7..6faed95aba 100644
--- a/util/system/cpu_id_ut.cpp
+++ b/util/system/cpu_id_ut.cpp
@@ -78,7 +78,7 @@ Y_UNIT_TEST_SUITE(TestCpuId) {
Y_UNIT_TEST(TestCpuBrand) {
ui32 store[12];
- //Cout << CpuBrand(store) << Endl;;
+ // Cout << CpuBrand(store) << Endl;;
UNIT_ASSERT(strlen(CpuBrand(store)) > 0);
}
diff --git a/util/system/datetime.h b/util/system/datetime.h
index f2c2c9f8c8..724ffff394 100644
--- a/util/system/datetime.h
+++ b/util/system/datetime.h
@@ -27,7 +27,7 @@ inline ui64 millisec() {
}
/// Current time in seconds since epoch
ui32 Seconds() noexcept;
-///Current thread time in microseconds
+/// Current thread time in microseconds
ui64 ThreadCPUUserTime() noexcept;
ui64 ThreadCPUSystemTime() noexcept;
ui64 ThreadCPUTime() noexcept;
diff --git a/util/system/defaults.c b/util/system/defaults.c
index 75710009ac..90a367c781 100644
--- a/util/system/defaults.c
+++ b/util/system/defaults.c
@@ -1,2 +1,2 @@
-//test for C-compiler compileability
+// test for C-compiler compileability
#include "defaults.h"
diff --git a/util/system/demangle_impl.h b/util/system/demangle_impl.h
index 081004f976..9184e1f560 100644
--- a/util/system/demangle_impl.h
+++ b/util/system/demangle_impl.h
@@ -18,4 +18,4 @@ namespace NPrivate {
THolder<char, TFree> TmpBuf_;
};
-} //namespace NPrivate
+} // namespace NPrivate
diff --git a/util/system/event.cpp b/util/system/event.cpp
index 42311d4835..9bb27aed2c 100644
--- a/util/system/event.cpp
+++ b/util/system/event.cpp
@@ -37,7 +37,7 @@ public:
const TInstant now = Now();
if (now < deadLine) {
- //TODO
+ // TODO
return WaitForSingleObject(cond, (deadLine - now).MilliSeconds()) == WAIT_OBJECT_0;
}
diff --git a/util/system/event.h b/util/system/event.h
index cab2fc478a..e4dc699672 100644
--- a/util/system/event.h
+++ b/util/system/event.h
@@ -46,7 +46,7 @@ public:
WaitD(TInstant::Max());
}
- //return true if signaled, false if timed out.
+ // return true if signaled, false if timed out.
inline bool Wait(ui32 timer) noexcept {
return WaitT(TDuration::MilliSeconds(timer));
}
diff --git a/util/system/file.cpp b/util/system/file.cpp
index 30bba71a03..1f029a71f9 100644
--- a/util/system/file.cpp
+++ b/util/system/file.cpp
@@ -297,7 +297,7 @@ TFileHandle::TFileHandle(const std::filesystem::path& path, EOpenMode oMode) noe
}
#endif
- //temp file
+ // temp file
if (Fd_ >= 0 && (oMode & Transient)) {
std::filesystem::remove(path);
}
@@ -670,7 +670,7 @@ bool TFileHandle::LinkTo(const TFileHandle& fh) const noexcept {
return false;
}
- //not thread-safe
+ // not thread-safe
nh.Swap(*const_cast<TFileHandle*>(this));
return true;
@@ -1336,7 +1336,7 @@ void TFile::LinkTo(const TFile& f) const {
}
TFile TFile::Temporary(const TString& prefix) {
- //TODO - handle impossible case of name collision
+ // TODO - handle impossible case of name collision
return TFile(prefix + ToString(MicroSeconds()) + "-" + ToString(RandomNumber<ui64>()), CreateNew | RdWr | Seq | Temp | Transient);
}
diff --git a/util/system/file.h b/util/system/file.h
index 57531fd8c9..ae73bb79c6 100644
--- a/util/system/file.h
+++ b/util/system/file.h
@@ -120,7 +120,7 @@ public:
bool FallocateNoResize(i64 length) noexcept;
bool ShrinkToFit() noexcept;
bool Flush() noexcept;
- //flush data only, without file metadata
+ // flush data only, without file metadata
bool FlushData() noexcept;
i32 Read(void* buffer, ui32 byteCount) noexcept;
i32 Write(const void* buffer, ui32 byteCount) noexcept;
@@ -131,22 +131,22 @@ public:
FHANDLE Duplicate() const noexcept;
int Duplicate2Posix(int dstHandle) const noexcept;
- //dup2 - like semantics, return true on success
+ // dup2 - like semantics, return true on success
bool LinkTo(const TFileHandle& fh) const noexcept;
- //very low-level methods
+ // very low-level methods
bool SetDirect();
void ResetDirect();
/* Manual file cache management, length = 0 means "as much as possible" */
- //measure amount of cached data in bytes, returns -1 if failed
+ // measure amount of cached data in bytes, returns -1 if failed
i64 CountCache(i64 offset = 0, i64 length = 0) const noexcept;
- //read data into cache and optionally wait for completion
+ // read data into cache and optionally wait for completion
void PrefetchCache(i64 offset = 0, i64 length = 0, bool wait = true) const noexcept;
- //remove clean and unused data from cache
+ // remove clean and unused data from cache
void EvictCache(i64 offset = 0, i64 length = 0) const noexcept;
- //flush unwritten data in this range and optionally wait for completion
+ // flush unwritten data in this range and optionally wait for completion
bool FlushCache(i64 offset = 0, i64 length = 0, bool wait = true) noexcept;
private:
@@ -207,19 +207,19 @@ public:
void Flock(int op);
- //do not use, their meaning very platform-dependant
+ // do not use, their meaning very platform-dependant
void SetDirect();
void ResetDirect();
/* Manual file cache management, length = 0 means "as much as possible" */
- //measure amount of cached data in bytes, returns -1 if failed
+ // measure amount of cached data in bytes, returns -1 if failed
i64 CountCache(i64 offset = 0, i64 length = 0) const noexcept;
- //read data into cache and optionally wait for completion
+ // read data into cache and optionally wait for completion
void PrefetchCache(i64 offset = 0, i64 length = 0, bool wait = true) const noexcept;
- //remove clean and unused data from cache, incomplete pages could stay
+ // remove clean and unused data from cache, incomplete pages could stay
void EvictCache(i64 offset = 0, i64 length = 0) const noexcept;
- //flush unwritten data in this range and optionally wait for completion
+ // flush unwritten data in this range and optionally wait for completion
void FlushCache(i64 offset = 0, i64 length = 0, bool wait = true);
static TFile Temporary(const TString& prefix);
diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp
index 8e25d84928..92b6e9902a 100644
--- a/util/system/filemap.cpp
+++ b/util/system/filemap.cpp
@@ -300,7 +300,7 @@ public:
void Evict() {
#if defined(_unix_)
-// Evict(PtrStart_, Length_);
+// Evict(PtrStart_, Length_);
#endif
}
diff --git a/util/system/filemap_ut.cpp b/util/system/filemap_ut.cpp
index 1305e34995..cfa13b8b4f 100644
--- a/util/system/filemap_ut.cpp
+++ b/util/system/filemap_ut.cpp
@@ -127,9 +127,9 @@ Y_UNIT_TEST_SUITE(TFileMapTest) {
}
#if defined(_asan_enabled_) || defined(_msan_enabled_)
-//setrlimit incompatible with asan runtime
+// setrlimit incompatible with asan runtime
#elif defined(_cygwin_)
-//cygwin is not real unix :(
+// cygwin is not real unix :(
#else
Y_UNIT_TEST(TestNotGreedy) {
unsigned page[4096 / sizeof(unsigned)];
diff --git a/util/system/fs.cpp b/util/system/fs.cpp
index 808bc0b7b6..0e5ffe4e41 100644
--- a/util/system/fs.cpp
+++ b/util/system/fs.cpp
@@ -88,7 +88,7 @@ bool NFs::MakeDirectoryRecursive(const TString& path, EFilePermissions mode, boo
}
return true;
} else {
- //NOTE: recursion is finite due to existence of "." and "/"
+ // NOTE: recursion is finite due to existence of "." and "/"
if (!NFs::MakeDirectoryRecursive(TFsPath(path).Parent(), mode, false)) {
return false;
}
diff --git a/util/system/fs_ut.cpp b/util/system/fs_ut.cpp
index ddee6670a8..2df9a3b2a4 100644
--- a/util/system/fs_ut.cpp
+++ b/util/system/fs_ut.cpp
@@ -6,7 +6,7 @@
#include "fstat.h"
#include <util/folder/path.h>
-//WARNING: on windows the test must be run with administative rules
+// WARNING: on windows the test must be run with administative rules
class TFsTest: public TTestBase {
UNIT_TEST_SUITE(TFsTest);
@@ -45,7 +45,7 @@ void TFsTest::TestCreateRemove() {
UNIT_ASSERT(NFs::Exists(dir1));
TFsPath subdir1 = dir1 / "a" / "b";
- //TFsPath link = dir1 / "link";
+ // TFsPath link = dir1 / "link";
UNIT_ASSERT(NFs::MakeDirectoryRecursive(subdir1, NFs::FP_COMMON_FILE, true));
UNIT_ASSERT(NFs::Exists(subdir1));
@@ -59,7 +59,7 @@ void TFsTest::TestCreateRemove() {
Touch(file1);
Touch(file2);
Touch(file3);
- //UNIT_ASSERT(NFs::SymLink(file3.RealPath(), link));
+ // UNIT_ASSERT(NFs::SymLink(file3.RealPath(), link));
UNIT_ASSERT(NFs::MakeDirectoryRecursive(dir1 / "subdir1" / "subdir2" / "subdir3" / "subdir4", NFs::FP_COMMON_FILE, false));
UNIT_ASSERT(NFs::MakeDirectoryRecursive(dir1 / "subdir1" / "subdir2", NFs::FP_COMMON_FILE, false));
@@ -80,7 +80,7 @@ void TFsTest::TestCreateRemove() {
UNIT_ASSERT(NFs::Exists(file1));
UNIT_ASSERT(NFs::Exists(file2));
UNIT_ASSERT(NFs::Exists(file3));
- //UNIT_ASSERT(NFs::Exists(link));
+ // UNIT_ASSERT(NFs::Exists(link));
UNIT_ASSERT(!NFs::Remove(dir1));
NFs::RemoveRecursive(dir1);
@@ -88,7 +88,7 @@ void TFsTest::TestCreateRemove() {
UNIT_ASSERT(!NFs::Exists(file1));
UNIT_ASSERT(!NFs::Exists(file2));
UNIT_ASSERT(!NFs::Exists(file3));
- //UNIT_ASSERT(!NFs::Exists(link));
+ // UNIT_ASSERT(!NFs::Exists(link));
UNIT_ASSERT(!NFs::Exists(subdir1));
UNIT_ASSERT(!NFs::Exists(longfile));
UNIT_ASSERT(!NFs::Exists(dir1));
@@ -186,7 +186,7 @@ static void RunHardlinkTest(const TFsPath& src, const TFsPath& dst) {
void TFsTest::TestHardlink() {
RunHardlinkTest("tempfile", "hardlinkfile");
- RunHardlinkTest("tempfile_абвг", "hardlinkfile_абвг"); //utf-8 names
+ RunHardlinkTest("tempfile_абвг", "hardlinkfile_абвг"); // utf-8 names
}
static void RunSymLinkTest(TString fileLocalName, TString symLinkName) {
@@ -240,7 +240,7 @@ static void RunSymLinkTest(TString fileLocalName, TString symLinkName) {
{
TFileStat fs(linkD1, true);
UNIT_ASSERT(!fs.IsFile());
- //UNIT_ASSERT(fs.IsDir()); // failed on unix
+ // UNIT_ASSERT(fs.IsDir()); // failed on unix
UNIT_ASSERT(fs.IsSymlink());
}
{
@@ -253,7 +253,7 @@ static void RunSymLinkTest(TString fileLocalName, TString symLinkName) {
{
TFileStat fs(symLinkName, true);
- //UNIT_ASSERT(fs.IsFile()); // no evidence that symlink has to be a file as well
+ // UNIT_ASSERT(fs.IsFile()); // no evidence that symlink has to be a file as well
UNIT_ASSERT(!fs.IsDir());
UNIT_ASSERT(fs.IsSymlink());
}
@@ -277,7 +277,7 @@ static void RunSymLinkTest(TString fileLocalName, TString symLinkName) {
void TFsTest::TestSymlink() {
// if previous running was failed
RunSymLinkTest("f.txt", "fl.txt");
- RunSymLinkTest("f_абвг.txt", "fl_абвг.txt"); //utf-8 names
+ RunSymLinkTest("f_абвг.txt", "fl_абвг.txt"); // utf-8 names
}
void TFsTest::TestCwdOpts() {
diff --git a/util/system/fs_win.cpp b/util/system/fs_win.cpp
index 16a87ff385..7f75d1e8b2 100644
--- a/util/system/fs_win.cpp
+++ b/util/system/fs_win.cpp
@@ -225,7 +225,7 @@ namespace NFsPrivate {
size_t len = rdb->MountPointReparseBuffer.SubstituteNameLength / sizeof(wchar16);
return WideToUTF8(str, len);
}
- //this reparse point is unsupported in arcadia
+ // this reparse point is unsupported in arcadia
return TString();
}
@@ -236,7 +236,7 @@ namespace NFsPrivate {
}
// we can't use this function to get an analog of unix inode due to a lot of NTFS folders do not have this GUID
- //(it will be 'create' case really)
+ // (it will be 'create' case really)
/*
bool GetObjectId(const char* path, GUID* id) {
TFileHandle h = CreateFileWithUtf8Name(path, 0, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
diff --git a/util/system/fstat_ut.cpp b/util/system/fstat_ut.cpp
index 300f76d7e6..0438063179 100644
--- a/util/system/fstat_ut.cpp
+++ b/util/system/fstat_ut.cpp
@@ -52,7 +52,7 @@ Y_UNIT_TEST_SUITE(TestFileStat) {
UNIT_ASSERT(!fs.IsFile());
UNIT_ASSERT(fs.IsDir());
UNIT_ASSERT(!fs.IsSymlink());
- //UNIT_ASSERT(fs.Size == 0); // it fails under unix
+ // UNIT_ASSERT(fs.Size == 0); // it fails under unix
UNIT_ASSERT(NFs::Remove("tmpd"));
fs = TFileStat("tmpd");
UNIT_ASSERT(!fs.IsFile());
diff --git a/util/system/guard.h b/util/system/guard.h
index b6ca45fff6..2b4192c01a 100644
--- a/util/system/guard.h
+++ b/util/system/guard.h
@@ -21,7 +21,7 @@ struct TTryLockOps: public TCommonLockOps<T> {
}
};
-//must be used with great care
+// must be used with great care
template <class TOps>
struct TInverseLockOps: public TOps {
template <class T>
diff --git a/util/system/info.cpp b/util/system/info.cpp
index 59a8ab0e0b..9a4997f549 100644
--- a/util/system/info.cpp
+++ b/util/system/info.cpp
@@ -19,7 +19,7 @@
#endif
#if defined(_bionic_)
-//TODO
+// TODO
#elif defined(_cygwin_)
static int getloadavg(double* loadavg, int nelem) {
for (int i = 0; i < nelem; ++i) {
diff --git a/util/system/mem_info.cpp b/util/system/mem_info.cpp
index 90ed353a59..75f2c1c493 100644
--- a/util/system/mem_info.cpp
+++ b/util/system/mem_info.cpp
@@ -119,7 +119,7 @@ namespace NMemInfo {
result.RSS = FromString<ui64>(statsiter.NextTok(' ')) * pagesize;
#if defined(_cygwin_)
- //cygwin not very accurate
+ // cygwin not very accurate
result.VMS = Max(result.VMS, result.RSS);
#endif
#elif defined(_freebsd_)
diff --git a/util/system/mlock.h b/util/system/mlock.h
index 41a9e4457e..7fe36095f9 100644
--- a/util/system/mlock.h
+++ b/util/system/mlock.h
@@ -4,11 +4,11 @@
#include <util/generic/flags.h>
-//on some systems (not win, freebd, linux, but darwin (Mac OS X)
-//multiple mlock calls on the same address range
-//require the corresponding number of munlock calls to actually unlock the pages
+// on some systems (not win, freebd, linux, but darwin (Mac OS X)
+// multiple mlock calls on the same address range
+// require the corresponding number of munlock calls to actually unlock the pages
-//on some systems you must have privilege and resource limit
+// on some systems you must have privilege and resource limit
void LockMemory(const void* addr, size_t len);
void UnlockMemory(const void* addr, size_t len);
diff --git a/util/system/mutex.h b/util/system/mutex.h
index 2899ed9a50..39d245b09c 100644
--- a/util/system/mutex.h
+++ b/util/system/mutex.h
@@ -55,7 +55,7 @@ public:
Release();
}
- //return opaque pointer to real handler
+ // return opaque pointer to real handler
void* Handle() const noexcept;
private:
diff --git a/util/system/pipe.h b/util/system/pipe.h
index 75d0360049..1bf8f9082a 100644
--- a/util/system/pipe.h
+++ b/util/system/pipe.h
@@ -2,7 +2,7 @@
#ifdef __GNUC__
#pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Warray-bounds" //need because of bug in gcc4.9.2
+ #pragma GCC diagnostic ignored "-Warray-bounds" // need because of bug in gcc4.9.2
#endif
#include "defaults.h"
diff --git a/util/system/rwlock.cpp b/util/system/rwlock.cpp
index d4664d72d6..9faff9df5f 100644
--- a/util/system/rwlock.cpp
+++ b/util/system/rwlock.cpp
@@ -11,7 +11,7 @@
#include "mutex.h"
#include "condvar.h"
-//darwin rwlocks not recursive
+// darwin rwlocks not recursive
class TRWMutex::TImpl {
public:
TImpl();
diff --git a/util/system/sem.cpp b/util/system/sem.cpp
index 1825ac3093..96affec792 100644
--- a/util/system/sem.cpp
+++ b/util/system/sem.cpp
@@ -16,7 +16,7 @@
#if defined(_bionic_) || defined(_darwin_) && defined(_arm_)
#include <fcntl.h>
#else
- #define USE_SYSV_SEMAPHORES //unixoids declared the standard but not implemented it...
+ #define USE_SYSV_SEMAPHORES // unixoids declared the standard but not implemented it...
#endif
#endif
@@ -83,7 +83,7 @@ namespace {
Handle = ::CreateSemaphore(0, max_free_count, max_free_count, key);
#else
#ifdef USE_SYSV_SEMAPHORES
- key_t key = TPCGMixer::Mix(CityHash64(name, strlen(name))); //32 bit hash
+ key_t key = TPCGMixer::Mix(CityHash64(name, strlen(name))); // 32 bit hash
Handle = semget(key, 0, 0); // try to open exist semaphore
if (Handle == -1) { // create new semaphore
Handle = semget(key, 1, 0666 | IPC_CREAT);
@@ -110,8 +110,8 @@ namespace {
#else
#ifdef USE_SYSV_SEMAPHORES
// we DO NOT want 'semctl(Handle, 0, IPC_RMID)' for multiprocess tasks;
- //struct sembuf ops[] = {{0, 0, IPC_NOWAIT}};
- //if (semop(Handle, ops, 1) != 0) // close only if semaphore's value is zero
+ // struct sembuf ops[] = {{0, 0, IPC_NOWAIT}};
+ // if (semop(Handle, ops, 1) != 0) // close only if semaphore's value is zero
// semctl(Handle, 0, IPC_RMID);
#else
sem_close(Handle); // we DO NOT want sem_unlink(...)
@@ -133,8 +133,8 @@ namespace {
#endif
}
- //The UNIX semaphore object does not support a timed "wait", and
- //hence to maintain consistancy, for win32 case we use INFINITE or 0 timeout.
+ // The UNIX semaphore object does not support a timed "wait", and
+ // hence to maintain consistancy, for win32 case we use INFINITE or 0 timeout.
inline void Acquire() noexcept {
#ifdef _win_
Y_ABORT_UNLESS(::WaitForSingleObject(Handle, INFINITE) == WAIT_OBJECT_0, "can not acquire semaphore");
diff --git a/util/system/sem.h b/util/system/sem.h
index 0c964ad6b6..e37799d148 100644
--- a/util/system/sem.h
+++ b/util/system/sem.h
@@ -4,20 +4,20 @@
#include <util/generic/ptr.h>
-//named sempahore
+// named sempahore
class TSemaphore {
public:
TSemaphore(const char* name, ui32 maxFreeCount);
~TSemaphore();
- //Increase the semaphore counter.
+ // Increase the semaphore counter.
void Release() noexcept;
- //Keep a thread held while the semaphore counter is equal 0.
+ // Keep a thread held while the semaphore counter is equal 0.
void Acquire() noexcept;
- //Try to enter the semaphore gate. A non-blocking variant of Acquire.
- //Returns 'true' if the semaphore counter decreased
+ // Try to enter the semaphore gate. A non-blocking variant of Acquire.
+ // Returns 'true' if the semaphore counter decreased
bool TryAcquire() noexcept;
private:
@@ -25,7 +25,7 @@ private:
THolder<TImpl> Impl_;
};
-//unnamed semaphore, faster, than previous
+// unnamed semaphore, faster, than previous
class TFastSemaphore {
public:
TFastSemaphore(ui32 maxFreeCount);
diff --git a/util/system/shmat.cpp b/util/system/shmat.cpp
index f10a1268e7..13fd4c236c 100644
--- a/util/system/shmat.cpp
+++ b/util/system/shmat.cpp
@@ -102,7 +102,7 @@ static void FormatName(char* buf, const TGUID& id) {
}
bool TSharedMemory::Open(const TGUID& id, int size) {
- //Y_ASSERT(Data == 0);
+ // Y_ASSERT(Data == 0);
Id = id;
Size = size;
@@ -117,7 +117,7 @@ bool TSharedMemory::Open(const TGUID& id, int size) {
Data = MapViewOfFile(Handle, FILE_MAP_ALL_ACCESS, 0, 0, size);
if (Data == 0) {
- //Y_ASSERT(0);
+ // Y_ASSERT(0);
CloseHandle(Handle);
Handle = INVALID_OS_HANDLE;
@@ -128,7 +128,7 @@ bool TSharedMemory::Open(const TGUID& id, int size) {
}
bool TSharedMemory::Create(int size) {
- //Y_ASSERT(Data == 0);
+ // Y_ASSERT(Data == 0);
Size = size;
CreateGuid(&Id);
@@ -138,14 +138,14 @@ bool TSharedMemory::Create(int size) {
Handle = CreateFileMappingA(INVALID_OS_HANDLE, nullptr, PAGE_READWRITE, 0, size, name);
if (Handle == 0) {
- //Y_ASSERT(0);
+ // Y_ASSERT(0);
return false;
}
Data = MapViewOfFile(Handle, FILE_MAP_ALL_ACCESS, 0, 0, size);
if (Data == 0) {
- //Y_ASSERT(0);
+ // Y_ASSERT(0);
CloseHandle(Handle);
Handle = INVALID_OS_HANDLE;
@@ -172,7 +172,7 @@ static key_t GetKey(const TGUID& id) {
bool TSharedMemory::Open(const TGUID& id, int size) {
Y_ABORT_UNLESS(id, "invalid shared memory guid: %s", GetGuidAsString(id).data());
- //Y_ASSERT(Data == 0);
+ // Y_ASSERT(Data == 0);
Size = size;
key_t k = GetKey(id);
@@ -185,7 +185,7 @@ bool TSharedMemory::Open(const TGUID& id, int size) {
Data = shmat(shmId, nullptr, 0);
if (Data == nullptr) {
- //Y_ASSERT(0);
+ // Y_ASSERT(0);
return false;
}
@@ -193,7 +193,7 @@ bool TSharedMemory::Open(const TGUID& id, int size) {
}
bool TSharedMemory::Create(int size) {
- //Y_ASSERT(Data == 0);
+ // Y_ASSERT(Data == 0);
Size = size;
CreateGuid(&Id);
@@ -202,14 +202,14 @@ bool TSharedMemory::Create(int size) {
Handle = shmget(k, Size, IPC_CREAT | IPC_EXCL | 0777);
if (Handle < 0) {
- //Y_ASSERT(0);
+ // Y_ASSERT(0);
return false;
}
Data = shmat(Handle, nullptr, 0);
if (Data == (void*)-1) {
- //Y_ASSERT(0);
+ // Y_ASSERT(0);
shmctl(Handle, IPC_RMID, nullptr);
Handle = -1;
diff --git a/util/system/spin_wait.cpp b/util/system/spin_wait.cpp
index ba12529111..fed173f307 100644
--- a/util/system/spin_wait.cpp
+++ b/util/system/spin_wait.cpp
@@ -16,7 +16,7 @@ namespace {
return (t * 4 + (rndNum % t) * 2) / 5;
}
- //arbitrary values
+ // arbitrary values
constexpr unsigned MIN_SLEEP_TIME = 500;
constexpr unsigned MAX_SPIN_COUNT = 0x7FF;
}
diff --git a/util/system/thread.cpp b/util/system/thread.cpp
index 8b0d988d23..a845fd4236 100644
--- a/util/system/thread.cpp
+++ b/util/system/thread.cpp
@@ -135,7 +135,7 @@ namespace {
{
TParamsRef p((TMyParams*)(ptr));
- //drop counter, gotten in Start()
+ // drop counter, gotten in Start()
p->UnRef();
SetThrName(*p);
@@ -146,7 +146,7 @@ namespace {
}
inline void Start() {
- //do not do this, kids, at home
+ // do not do this, kids, at home
P_->Ref();
#if _WIN32_WINNT < 0x0502
Handle = reinterpret_cast<HANDLE>(::_beginthreadex(nullptr, (unsigned)StackSize(*P_), Proxy, (void*)P_.Get(), 0, &ThreadId));
@@ -170,7 +170,7 @@ namespace {
using TThreadBase = TWinThread;
#else
- //unix
+ // unix
#define PCHECK(x, y) \
{ \
diff --git a/util/system/tls.cpp b/util/system/tls.cpp
index 40d748274e..5979576a4a 100644
--- a/util/system/tls.cpp
+++ b/util/system/tls.cpp
@@ -126,7 +126,7 @@ namespace {
}
inline ~TMasterTls() override {
- //explicitly call dtor for main thread
+ // explicitly call dtor for main thread
Dtor(pthread_getspecific(Key_));
Y_ABORT_UNLESS(!pthread_key_delete(Key_), "pthread_key_delete failed");
diff --git a/util/system/tls.h b/util/system/tls.h
index 3c4f56dbeb..1771663e88 100644
--- a/util/system/tls.h
+++ b/util/system/tls.h
@@ -45,9 +45,9 @@
Example:
@code
- //the field declaration in header
+ // the field declaration in header
Y_THREAD(TBuffer) TmpBuffer;
- //...later somewhere in cpp...
+ // ...later somewhere in cpp...
TmpBuffer.Clear();
for (size_t i = 0; i < sz && TrieCursor[i].second.IsFork(); ++i) {
TmpBuffer.Append(TrieCursor[i].second.Char);
@@ -56,9 +56,9 @@
Example:
@code
- //the field decalrataion in header
+ // the field decalrataion in header
Y_THREAD(TMyWriter*) ThreadLocalWriter;
- //...later somewhere in cpp...
+ // ...later somewhere in cpp...
TMyWriter*& writerRef = ThreadLocalWriter.Get();
if (writerRef == nullptr) {
THolder<TMyWriter> threadLocalWriter( new TMyWriter(
@@ -74,11 +74,11 @@
Example:
@code
- //in header
+ // in header
namespace TMorph {
Y_THREAD(ELanguage) ThreadLocalMainLanguage;
}
- //in cpp
+ // in cpp
Y_THREAD(ELanguage) TMorph::ThreadLocalMainLanguage(LANG_RUS);
@endcode
@@ -192,7 +192,7 @@ namespace NTls {
~TDefaultConstructor() override = default;
T* Construct(void* ptr) const override {
- //memset(ptr, 0, sizeof(T));
+ // memset(ptr, 0, sizeof(T));
return ::new (ptr) T();
}
};