Changeset View
Changeset View
Standalone View
Standalone View
src/test/util_tests.cpp
Show First 20 Lines • Show All 1,263 Lines • ▼ Show 20 Lines | #endif | ||||
// Another lock on the directory from a different thread within the same | // Another lock on the directory from a different thread within the same | ||||
// process should succeed | // process should succeed | ||||
bool threadresult; | bool threadresult; | ||||
std::thread thr(TestOtherThread, dirname, lockname, &threadresult); | std::thread thr(TestOtherThread, dirname, lockname, &threadresult); | ||||
thr.join(); | thr.join(); | ||||
BOOST_CHECK_EQUAL(threadresult, true); | BOOST_CHECK_EQUAL(threadresult, true); | ||||
#ifndef WIN32 | #ifndef WIN32 | ||||
// Try to aquire lock in child process while we're holding it, this should | // Try to acquire lock in child process while we're holding it, this should | ||||
// fail. | // fail. | ||||
char ch; | char ch; | ||||
BOOST_CHECK_EQUAL(write(fd[1], &LockCommand, 1), 1); | BOOST_CHECK_EQUAL(write(fd[1], &LockCommand, 1), 1); | ||||
BOOST_CHECK_EQUAL(read(fd[1], &ch, 1), 1); | BOOST_CHECK_EQUAL(read(fd[1], &ch, 1), 1); | ||||
BOOST_CHECK_EQUAL((bool)ch, false); | BOOST_CHECK_EQUAL((bool)ch, false); | ||||
// Give up our lock | // Give up our lock | ||||
ReleaseDirectoryLocks(); | ReleaseDirectoryLocks(); | ||||
▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines |