void lockTtlThread(util::ThreadArgs& args) { MultiMap<std::string, std::string> *mm = (MultiMap<std::string, std::string> *)args.arg0; util::CountDownLatch *latch = (util::CountDownLatch *)args.arg1; if (!mm->tryLock("key1")) { latch->countDown(); } if (mm->tryLock("key1", 5 * 1000)) { latch->countDown(); } }
void tryLockThread2(util::ThreadArgs& args) { MultiMap<std::string, std::string> *mm = (MultiMap<std::string, std::string> *)args.arg0; util::CountDownLatch *latch = (util::CountDownLatch *)args.arg1; try { if (mm->tryLock("key1", 20 * 1000)) { latch->countDown(); } } catch (...) { std::cerr << "Unexpected exception at ClientMultiMapTest lockThread2" << std::endl; } }