mirror of
https://github.com/debauchee/barrier.git
synced 2026-07-07 04:18:07 +08:00
Apply tab to spaces filter to src folder
This commit is contained in:
@@ -38,35 +38,35 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
#if SYSAPI_WIN32
|
||||
// record window instance for tray icon, etc
|
||||
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
|
||||
// record window instance for tray icon, etc
|
||||
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
|
||||
#endif
|
||||
|
||||
Arch arch;
|
||||
arch.init();
|
||||
|
||||
Log log;
|
||||
log.setFilter(kDEBUG2);
|
||||
Arch arch;
|
||||
arch.init();
|
||||
|
||||
Log log;
|
||||
log.setFilter(kDEBUG2);
|
||||
|
||||
string lockFile;
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (string(argv[i]).compare("--lock-file") == 0) {
|
||||
lockFile = argv[i + 1];
|
||||
}
|
||||
}
|
||||
string lockFile;
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (string(argv[i]).compare("--lock-file") == 0) {
|
||||
lockFile = argv[i + 1];
|
||||
}
|
||||
}
|
||||
|
||||
if (!lockFile.empty()) {
|
||||
lock(lockFile);
|
||||
}
|
||||
if (!lockFile.empty()) {
|
||||
lock(lockFile);
|
||||
}
|
||||
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
int result = RUN_ALL_TESTS();
|
||||
int result = RUN_ALL_TESTS();
|
||||
|
||||
if (!lockFile.empty()) {
|
||||
unlock(lockFile);
|
||||
}
|
||||
if (!lockFile.empty()) {
|
||||
unlock(lockFile);
|
||||
}
|
||||
|
||||
// gtest seems to randomly finish with error codes (e.g. -1, -1073741819)
|
||||
// even when no tests have failed. not sure what causes this, but it
|
||||
@@ -79,30 +79,30 @@ main(int argc, char **argv)
|
||||
void
|
||||
lock(string lockFile)
|
||||
{
|
||||
double start = ARCH->time();
|
||||
|
||||
// keep checking until timeout is reached.
|
||||
while ((ARCH->time() - start) < LOCK_TIMEOUT) {
|
||||
double start = ARCH->time();
|
||||
|
||||
// keep checking until timeout is reached.
|
||||
while ((ARCH->time() - start) < LOCK_TIMEOUT) {
|
||||
|
||||
ifstream is(lockFile.c_str());
|
||||
bool noLock = !is;
|
||||
is.close();
|
||||
ifstream is(lockFile.c_str());
|
||||
bool noLock = !is;
|
||||
is.close();
|
||||
|
||||
if (noLock) {
|
||||
break;
|
||||
}
|
||||
if (noLock) {
|
||||
break;
|
||||
}
|
||||
|
||||
// check every second if file has gone.
|
||||
ARCH->sleep(1);
|
||||
}
|
||||
// check every second if file has gone.
|
||||
ARCH->sleep(1);
|
||||
}
|
||||
|
||||
// write empty lock file.
|
||||
ofstream os(lockFile.c_str());
|
||||
os.close();
|
||||
// write empty lock file.
|
||||
ofstream os(lockFile.c_str());
|
||||
os.close();
|
||||
}
|
||||
|
||||
void
|
||||
unlock(string lockFile)
|
||||
{
|
||||
remove(lockFile.c_str());
|
||||
remove(lockFile.c_str());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user