// ----
Cond cond;
-Mutex lock("lock");
+Mutex wait_lock("lock");
bool done;
void wait()
{
- lock.Lock();
+ wait_lock.Lock();
while (!done)
- cond.Wait(lock);
- lock.Unlock();
+ cond.Wait(wait_lock);
+ wait_lock.Unlock();
}
// ----
bufferlist bl;
bl.append("small");
- j.submit_entry(1, bl, 0, new C_SafeCond(&lock, &cond, &done));
+ j.submit_entry(1, bl, 0, new C_SafeCond(&wait_lock, &cond, &done));
wait();
j.close();
memset(foo, 1, sizeof(foo));
bl.append(foo, sizeof(foo));
}
- j.submit_entry(1, bl, 0, new C_SafeCond(&lock, &cond, &done));
+ j.submit_entry(1, bl, 0, new C_SafeCond(&wait_lock, &cond, &done));
wait();
j.close();
ASSERT_EQ(0, j.create());
j.make_writeable();
- C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&lock, &cond, &done));
+ C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&wait_lock, &cond, &done));
bufferlist bl;
bl.append("small");
ASSERT_EQ(0, j.create());
j.make_writeable();
- C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&lock, &cond, &done));
+ C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&wait_lock, &cond, &done));
bufferlist first;
first.append("small");
ASSERT_EQ(0, j.create());
j.make_writeable();
- C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&lock, &cond, &done));
+ C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&wait_lock, &cond, &done));
bufferlist bl;
bl.append("small");
ASSERT_EQ(0, j.create());
j.make_writeable();
- C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&lock, &cond, &done));
+ C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&wait_lock, &cond, &done));
const char *needle = "i am a needle";
const char *newneedle = "in a haystack";
ASSERT_EQ(0, j.create());
j.make_writeable();
- C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&lock, &cond, &done));
+ C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&wait_lock, &cond, &done));
const char *needle = "i am a needle";
for (unsigned i = 1; i <= 4; ++i) {
bufferlist bl;
bl.append("needle");
- j.submit_entry(5, bl, 0, new C_SafeCond(&lock, &cond, &done));
+ j.submit_entry(5, bl, 0, new C_SafeCond(&wait_lock, &cond, &done));
wait();
j.close();
ASSERT_EQ(0, j.create());
j.make_writeable();
- C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&lock, &cond, &done));
+ C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&wait_lock, &cond, &done));
const char *needle = "i am a needle";
for (unsigned i = 1; i <= 4; ++i) {
bufferlist bl;
bl.append("needle");
- j.submit_entry(5, bl, 0, new C_SafeCond(&lock, &cond, &done));
+ j.submit_entry(5, bl, 0, new C_SafeCond(&wait_lock, &cond, &done));
wait();
j.close();
ASSERT_EQ(0, j.create());
j.make_writeable();
- C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&lock, &cond, &done));
+ C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&wait_lock, &cond, &done));
const char *needle = "i am a needle";
for (unsigned i = 1; i <= 4; ++i) {
bufferlist bl;
bl.append("needle");
- j.submit_entry(5, bl, 0, new C_SafeCond(&lock, &cond, &done));
+ j.submit_entry(5, bl, 0, new C_SafeCond(&wait_lock, &cond, &done));
wait();
j.close();