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


##########
cpp/src/arrow/device.h:
##########
@@ -98,6 +100,52 @@ class ARROW_EXPORT Device : public 
std::enable_shared_from_this<Device>,
   /// \brief Return the DeviceAllocationType of this device
   virtual DeviceAllocationType device_type() const = 0;
 
+  /// \brief EXPERIMENTAL: An opaque wrapper for Device-specific streams
+  ///
+  /// In essence this is just a wrapper around a void* to represent the
+  /// standard concept of a stream/queue on a device. Derived classes
+  /// should be trivially constructable from it's device-specific counterparts.
+  class ARROW_EXPORT Stream {
+   public:
+    virtual const void* get_raw() const { return NULLPTR; }
+
+   protected:
+    Stream() = default;
+    virtual ~Stream() = default;
+  };
+
+  /// \brief EXPERIMENTAL: An object that provides event/stream sync primitives
+  class ARROW_EXPORT SyncEvent {
+   public:
+    using release_fn_t = void (*)(void*);
+
+    virtual ~SyncEvent() = default;
+
+    void* get_raw() { return sync_event_.get(); }
+
+    /// @brief Block until sync event is completed.
+    virtual Status Wait() = 0;
+
+    /// @brief Make the provided stream wait on the sync event.
+    ///
+    /// Tells the provided stream that it should wait until the
+    /// synchronization event is completed without blocking the CPU.
+    virtual Status StreamWait(const Stream&) = 0;
+
+    /// @brief Record the wrapped event on the stream so it triggers
+    /// the event when the stream gets to that point in its queue.
+    virtual Status Record(const Stream&) = 0;
+
+   protected:
+    /// If creating this with a passed in event, the caller must ensure
+    /// that the event lives until clear_event is called on this as it
+    /// won't own it.
+    explicit SyncEvent(std::unique_ptr<void, void (*)(void*)> sync_event)

Review Comment:
   Does it make sense to use `release_fn_t` here instead of `void (*)(void *)`?



-- 
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