This is an automated email from the ASF dual-hosted git repository.

zhli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 9bbe1f0970 [GLUTEN-9736][VL] Fix store ID mismatch (#9746)
9bbe1f0970 is described below

commit 9bbe1f0970efc0b41e6894eed01dec911c409209
Author: Zhen Li <[email protected]>
AuthorDate: Mon May 26 15:58:20 2025 +0800

    [GLUTEN-9736][VL] Fix store ID mismatch (#9746)
    
    Fixes: #9736
---
 cpp/core/utils/ObjectStore.cc | 11 +++++++++++
 cpp/core/utils/ObjectStore.h  | 10 +---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/cpp/core/utils/ObjectStore.cc b/cpp/core/utils/ObjectStore.cc
index e516566e85..5ce6cf7238 100644
--- a/cpp/core/utils/ObjectStore.cc
+++ b/cpp/core/utils/ObjectStore.cc
@@ -19,6 +19,17 @@
 #include <glog/logging.h>
 #include <iostream>
 
+//static
+std::unique_ptr<gluten::ObjectStore> gluten::ObjectStore::create() {
+  static std::mutex mtx;
+  std::lock_guard<std::mutex> lock(mtx);
+  StoreHandle nextId = stores().nextId();
+  auto store = std::unique_ptr<gluten::ObjectStore>(new 
gluten::ObjectStore(nextId));
+  StoreHandle storeId = safeCast<StoreHandle>(stores().insert(store.get()));
+  GLUTEN_CHECK(storeId == nextId, "Store ID mismatched, this should not 
happen");
+  return store;
+}
+
 // static
 gluten::ResourceMap<gluten::ObjectStore*>& gluten::ObjectStore::stores() {
   static gluten::ResourceMap<gluten::ObjectStore*> stores;
diff --git a/cpp/core/utils/ObjectStore.h b/cpp/core/utils/ObjectStore.h
index e4cd3f8acc..476c406e73 100644
--- a/cpp/core/utils/ObjectStore.h
+++ b/cpp/core/utils/ObjectStore.h
@@ -49,15 +49,7 @@ struct SafeSizeOf<void> {
 // a shared-ptr's lifecycle to a Java-side object or some kind of resource 
manager.
 class ObjectStore {
  public:
-  static std::unique_ptr<ObjectStore> create() {
-    static std::mutex mtx;
-    std::lock_guard<std::mutex> lock(mtx);
-    StoreHandle nextId = stores().nextId();
-    auto store = std::unique_ptr<ObjectStore>(new ObjectStore(nextId));
-    StoreHandle storeId = safeCast<StoreHandle>(stores().insert(store.get()));
-    GLUTEN_CHECK(storeId == nextId, "Store ID mismatched, this should not 
happen");
-    return store;
-  }
+  static std::unique_ptr<ObjectStore> create();
 
   static void release(ObjectHandle handle) {
     ResourceHandle storeId = safeCast<ResourceHandle>(handle >> 
(sizeof(ResourceHandle) * 8));


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to