20
20
using poolCreateExtParams = std::tuple<umf_memory_pool_ops_t *, void *,
21
21
umf_memory_provider_ops_t *, void *>;
22
22
23
- umf::pool_unique_handle_t poolCreateExt (poolCreateExtParams params) {
24
- umf_memory_provider_handle_t hProvider;
23
+ umf::pool_unique_handle_t poolCreateExtUnique (poolCreateExtParams params) {
25
24
umf_memory_pool_handle_t hPool;
26
25
auto [pool_ops, pool_params, provider_ops, provider_params] = params;
27
26
28
- auto ret =
29
- umfMemoryProviderCreate (provider_ops, provider_params, &hProvider );
27
+ auto ret = umfPoolCreateEx (pool_ops, pool_params, provider_ops,
28
+ provider_params, &hPool );
30
29
EXPECT_EQ (ret, UMF_RESULT_SUCCESS);
31
30
32
- ret = umfPoolCreate (pool_ops, hProvider, pool_params, &hPool);
33
- EXPECT_EQ (ret, UMF_RESULT_SUCCESS);
34
-
35
- // capture provider and destroy it after the pool is destroyed
36
- auto poolDestructor = [hProvider](umf_memory_pool_handle_t pool) {
37
- umfPoolDestroy (pool);
38
- umfMemoryProviderDestroy (hProvider);
39
- };
40
-
41
- return umf::pool_unique_handle_t (hPool, std::move (poolDestructor));
31
+ return umf::pool_unique_handle_t (hPool, &umfPoolDestroy);
42
32
}
43
33
44
34
struct umfPoolTest : umf_test::test,
45
35
::testing::WithParamInterface<poolCreateExtParams> {
46
36
void SetUp () override {
47
37
test::SetUp ();
48
- pool = poolCreateExt (this ->GetParam ());
38
+ pool = poolCreateExtUnique (this ->GetParam ());
49
39
}
50
40
51
41
void TearDown () override { test::TearDown (); }
@@ -64,7 +54,7 @@ struct umfMultiPoolTest : umf_test::test,
64
54
void SetUp () override {
65
55
test::SetUp ();
66
56
for (size_t i = 0 ; i < numPools; i++) {
67
- pools.emplace_back (poolCreateExt (this ->GetParam ()));
57
+ pools.emplace_back (poolCreateExtUnique (this ->GetParam ()));
68
58
}
69
59
}
70
60
@@ -81,7 +71,7 @@ struct umfMemTest
81
71
test::SetUp ();
82
72
83
73
auto [params, expectedRecycledPoolAllocs] = this ->GetParam ();
84
- pool = poolCreateExt (params);
74
+ pool = poolCreateExtUnique (params);
85
75
this ->expectedRecycledPoolAllocs = expectedRecycledPoolAllocs;
86
76
}
87
77
0 commit comments