Commit 20db7232 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

make {{{test_partitioned_counter}}} exhibit the bug from Refs #5321.

git-svn-id: file:///svn/toku/tokudb@46348 c7de825b-a66e-492c-adef-691d508d4ae1
parent c56f57d8
......@@ -328,10 +328,12 @@ static void do_testit (void) {
tas[i].total_increment_per_writer = limits[i]/n_writers[i];
assert(tas[i].total_increment_per_writer * n_writers[i] == limits[i]);
pt_create(&reader_threads[i], reader_test_fun, &tas[i]);
increment_partitioned_counter(tas[i].pc, 1); // make sure that the long-lived thread also increments the partitioned counter, to test for #5321.
MALLOC_N(n_writers[i], writer_threads[i]);
for (uint64_t j=0; j<n_writers[i] ; j++) {
pt_create(&writer_threads[i][j], writer_test_fun, &tas[i]);
}
increment_partitioned_counter(tas[i].pc, -1); // make sure that the long-lived thread also increments the partitioned counter, to test for #5321.
}
for (int i=0; i<NGROUPS; i++) {
pt_join(reader_threads[i], &tas[i]);
......@@ -360,8 +362,10 @@ static void do_testit2 (void)
pthread_t t;
{
PARTITIONED_COUNTER mypc = create_partitioned_counter();
increment_partitioned_counter(mypc, 1); // make sure that the long-lived thread also increments the partitioned counter, to test for #5321.
pt_create(&t, test2_fun, mypc);
while(spinwait==0); // wait until he incremented the counter.
increment_partitioned_counter(mypc, -1);
assert(read_partitioned_counter(mypc)==3);
destroy_partitioned_counter(mypc);
} // leave scope, so the counter goes away.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment