@@ -473,7 +473,7 @@ TEST_P(umfIpcTest, openInTwoIpcHandlers) {
473473 EXPECT_EQ (stat.closeCount , stat.openCount );
474474}
475475
476- TEST_P (umfIpcTest, ConcurrentGetPutHandles ) {
476+ TEST_P (umfIpcTest, ConcurrentGetConcurrentPutHandles ) {
477477 std::vector<void *> ptrs;
478478 constexpr size_t ALLOC_SIZE = 100 ;
479479 constexpr size_t NUM_POINTERS = 100 ;
@@ -522,6 +522,44 @@ TEST_P(umfIpcTest, ConcurrentGetPutHandles) {
522522 EXPECT_EQ (stat.putCount , stat.getCount );
523523}
524524
525+ TEST_P (umfIpcTest, ConcurrentGetPutHandles) {
526+ std::vector<void *> ptrs;
527+ constexpr size_t ALLOC_SIZE = 100 ;
528+ constexpr size_t NUM_POINTERS = 100 ;
529+ umf::pool_unique_handle_t pool = makePool ();
530+ ASSERT_NE (pool.get (), nullptr );
531+
532+ for (size_t i = 0 ; i < NUM_POINTERS; ++i) {
533+ void *ptr = umfPoolMalloc (pool.get (), ALLOC_SIZE);
534+ EXPECT_NE (ptr, nullptr );
535+ ptrs.push_back (ptr);
536+ }
537+
538+ umf_test::syncthreads_barrier syncthreads (NTHREADS);
539+
540+ auto getPutHandlesFn = [&ptrs, &syncthreads](size_t ) {
541+ syncthreads ();
542+ for (void *ptr : ptrs) {
543+ umf_ipc_handle_t ipcHandle;
544+ size_t handleSize;
545+ umf_result_t ret = umfGetIPCHandle (ptr, &ipcHandle, &handleSize);
546+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
547+ ret = umfPutIPCHandle (ipcHandle);
548+ EXPECT_EQ (ret, UMF_RESULT_SUCCESS);
549+ }
550+ };
551+
552+ umf_test::parallel_exec (NTHREADS, getPutHandlesFn);
553+
554+ for (void *ptr : ptrs) {
555+ umf_result_t ret = umfPoolFree (pool.get (), ptr);
556+ EXPECT_EQ (ret, UMF_RESULT_SUCCESS);
557+ }
558+
559+ pool.reset (nullptr );
560+ EXPECT_EQ (stat.putCount , stat.getCount );
561+ }
562+
525563TEST_P (umfIpcTest, ConcurrentOpenCloseHandles) {
526564 umf_result_t ret;
527565 std::vector<void *> ptrs;
0 commit comments