@@ -14,7 +14,7 @@ static size_t INITIAL_ELEMENTS = 512;
1414 * erase all elements and read them from the other threads. */
1515static void
1616test_erase_find (nvobj::pool<root> &pop,
17- nvobj::persistent_ptr<container_string > &ptr)
17+ nvobj::persistent_ptr<container_string_mt > &ptr)
1818{
1919 const size_t value_repeats = 1000 ;
2020 size_t threads = 4 ;
@@ -26,7 +26,7 @@ test_erase_find(nvobj::pool<root> &pop,
2626
2727 auto erase_f = [&] {
2828 for (size_t i = 0 ; i < INITIAL_ELEMENTS; ++i) {
29- ptr->erase (key<container_string >(i));
29+ ptr->erase (key<container_string_mt >(i));
3030 ptr->garbage_collect ();
3131 }
3232 };
@@ -38,11 +38,11 @@ test_erase_find(nvobj::pool<root> &pop,
3838 for (size_t i = 0 ; i < INITIAL_ELEMENTS; ++i) {
3939 w.critical ([&] {
4040 auto res = ptr->find (
41- key<container_string >(i));
41+ key<container_string_mt >(i));
4242 UT_ASSERT (
4343 res == ptr->end () ||
4444 res->value () ==
45- value<container_string >(
45+ value<container_string_mt >(
4646 i,
4747 value_repeats));
4848 });
@@ -57,8 +57,9 @@ test_erase_find(nvobj::pool<root> &pop,
5757
5858 ptr->runtime_finalize_mt ();
5959
60- nvobj::transaction::run (
61- pop, [&] { nvobj::delete_persistent<container_string>(ptr); });
60+ nvobj::transaction::run (pop, [&] {
61+ nvobj::delete_persistent<container_string_mt>(ptr);
62+ });
6263
6364 UT_ASSERTeq (num_allocs (pop), 0 );
6465}
@@ -67,7 +68,7 @@ test_erase_find(nvobj::pool<root> &pop,
6768 * Concurrently try to read this element from other threads */
6869static void
6970test_write_erase_find (nvobj::pool<root> &pop,
70- nvobj::persistent_ptr<container_string > &ptr)
71+ nvobj::persistent_ptr<container_string_mt > &ptr)
7172{
7273 const size_t value_repeats = 1000 ;
7374 size_t threads = 8 ;
@@ -79,9 +80,10 @@ test_write_erase_find(nvobj::pool<root> &pop,
7980
8081 auto writer_f = [&] {
8182 for (size_t i = 0 ; i < INITIAL_ELEMENTS; ++i) {
82- ptr->emplace (key<container_string>(0 ),
83- value<container_string>(0 , value_repeats));
84- ptr->erase (key<container_string>(0 ));
83+ ptr->emplace (
84+ key<container_string_mt>(0 ),
85+ value<container_string_mt>(0 , value_repeats));
86+ ptr->erase (key<container_string_mt>(0 ));
8587 ptr->garbage_collect ();
8688 }
8789 };
@@ -93,11 +95,11 @@ test_write_erase_find(nvobj::pool<root> &pop,
9395 for (size_t i = 0 ; i < INITIAL_ELEMENTS; ++i) {
9496 w.critical ([&] {
9597 auto res = ptr->find (
96- key<container_string >(0 ));
98+ key<container_string_mt >(0 ));
9799 UT_ASSERT (
98100 res == ptr->end () ||
99101 res->value () ==
100- value<container_string >(
102+ value<container_string_mt >(
101103 0 ,
102104 value_repeats));
103105 });
@@ -111,8 +113,9 @@ test_write_erase_find(nvobj::pool<root> &pop,
111113
112114 ptr->runtime_finalize_mt ();
113115
114- nvobj::transaction::run (
115- pop, [&] { nvobj::delete_persistent<container_string>(ptr); });
116+ nvobj::transaction::run (pop, [&] {
117+ nvobj::delete_persistent<container_string_mt>(ptr);
118+ });
116119
117120 UT_ASSERTeq (num_allocs (pop), 0 );
118121}
@@ -123,7 +126,7 @@ test_write_erase_find(nvobj::pool<root> &pop,
123126 * deleting and reading elements */
124127static void
125128test_garbage_collection (nvobj::pool<root> &pop,
126- nvobj::persistent_ptr<container_string > &ptr)
129+ nvobj::persistent_ptr<container_string_mt > &ptr)
127130{
128131 const size_t value_repeats = 1000 ;
129132 size_t threads = 8 ;
@@ -139,7 +142,7 @@ test_garbage_collection(nvobj::pool<root> &pop,
139142 if (id == 0 ) {
140143 /* deleter */
141144 for (size_t i = 0 ; i < INITIAL_ELEMENTS; ++i) {
142- ptr->erase (key<container_string >(i));
145+ ptr->erase (key<container_string_mt >(i));
143146
144147 if (i % 50 == 0 ) {
145148 syncthreads ();
@@ -154,11 +157,11 @@ test_garbage_collection(nvobj::pool<root> &pop,
154157 for (size_t i = 0 ; i < INITIAL_ELEMENTS; ++i) {
155158 w.critical ([&] {
156159 auto res = ptr->find (
157- key<container_string >(i));
160+ key<container_string_mt >(i));
158161 UT_ASSERT (
159162 res == ptr->end () ||
160163 res->value () ==
161- value<container_string >(
164+ value<container_string_mt >(
162165 i,
163166 value_repeats));
164167 });
@@ -177,8 +180,9 @@ test_garbage_collection(nvobj::pool<root> &pop,
177180
178181 ptr->runtime_finalize_mt ();
179182
180- nvobj::transaction::run (
181- pop, [&] { nvobj::delete_persistent<container_string>(ptr); });
183+ nvobj::transaction::run (pop, [&] {
184+ nvobj::delete_persistent<container_string_mt>(ptr);
185+ });
182186
183187 UT_ASSERTeq (num_allocs (pop), 0 );
184188}
@@ -201,9 +205,9 @@ test(int argc, char *argv[])
201205 UT_FATAL (" !pool::create: %s %s" , pe.what (), path);
202206 }
203207
204- test_erase_find (pop, pop.root ()->radix_str );
205- test_write_erase_find (pop, pop.root ()->radix_str );
206- test_garbage_collection (pop, pop.root ()->radix_str );
208+ test_erase_find (pop, pop.root ()->radix_str_mt );
209+ test_write_erase_find (pop, pop.root ()->radix_str_mt );
210+ test_garbage_collection (pop, pop.root ()->radix_str_mt );
207211
208212 pop.close ();
209213}
0 commit comments