pitrou commented on code in PR #37040:
URL: https://github.com/apache/arrow/pull/37040#discussion_r1301870032


##########
cpp/src/arrow/device.h:
##########
@@ -165,6 +215,20 @@ class ARROW_EXPORT MemoryManager : public 
std::enable_shared_from_this<MemoryMan
   static Result<std::shared_ptr<Buffer>> ViewBuffer(
       const std::shared_ptr<Buffer>& source, const 
std::shared_ptr<MemoryManager>& to);
 
+  /// \brief Create a SyncEvent for exporting
+  ///
+  /// This version should construct the appropriate event for the device and
+  /// provide the unique_ptr with the correct deleter for the event type.
+  virtual Result<std::shared_ptr<Device::SyncEvent>> MakeDeviceSyncEvent();
+
+  /// \brief Create a SyncEvent from imported device array.
+  ///
+  /// @param sync_event passed in sync_event from the imported device array.
+  /// @param release_sync_event destructor to free sync_event. `nullptr` may be
+  ///        passed to indicate that no destruction/freeing is necessary
+  virtual Result<std::shared_ptr<Device::SyncEvent>> MakeDeviceSyncEvent(

Review Comment:
   Hmm, so there are two possible uses: wrap an owned sync event and wrap a 
borrowed one, is it right?
   If that's the case, then passing the actual release func, isn't necessary. 
Just need a boolean flag, or two separate methods for clarity.



##########
cpp/src/arrow/device.h:
##########
@@ -165,6 +215,20 @@ class ARROW_EXPORT MemoryManager : public 
std::enable_shared_from_this<MemoryMan
   static Result<std::shared_ptr<Buffer>> ViewBuffer(
       const std::shared_ptr<Buffer>& source, const 
std::shared_ptr<MemoryManager>& to);
 
+  /// \brief Create a SyncEvent for exporting
+  ///
+  /// This version should construct the appropriate event for the device and
+  /// provide the unique_ptr with the correct deleter for the event type.
+  virtual Result<std::shared_ptr<Device::SyncEvent>> MakeDeviceSyncEvent();
+
+  /// \brief Create a SyncEvent from imported device array.
+  ///
+  /// @param sync_event passed in sync_event from the imported device array.
+  /// @param release_sync_event destructor to free sync_event. `nullptr` may be
+  ///        passed to indicate that no destruction/freeing is necessary
+  virtual Result<std::shared_ptr<Device::SyncEvent>> MakeDeviceSyncEvent(

Review Comment:
   Hmm, so there are two possible uses: wrap an owned sync event and wrap a 
borrowed one, is it right?
   If that's the case, then passing the actual release func isn't necessary. 
Just need a boolean flag, or two separate methods for clarity.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to