summaryrefslogtreecommitdiff
path: root/libs/pbd/pbd/abstract_ui.h
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-12-28 10:14:17 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2015-12-28 10:14:17 -0500
commit0d9efc11484c901795ff4e9549a1a39715d0474d (patch)
tree956ab3cd570670bcb1ff68856553f5aec4a8e470 /libs/pbd/pbd/abstract_ui.h
parentdb4834027858b10f313c822c7fb3fad1617f11aa (diff)
redesign cross-thread registration/signalling system
This new design will work even when threads that need to receive messages from RT threads are created *after* the RT threads. The existing design would fail because the RT thread(s) would never be known the later created threads, and so signals emitted by the RT thread and causing call_slot() in the receiver would end up being enqueued using a lock-protected list. The new design ensures that communication always uses a lock-free FIFO instead
Diffstat (limited to 'libs/pbd/pbd/abstract_ui.h')
-rw-r--r--libs/pbd/pbd/abstract_ui.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/libs/pbd/pbd/abstract_ui.h b/libs/pbd/pbd/abstract_ui.h
index 5491210db7..78a337fc40 100644
--- a/libs/pbd/pbd/abstract_ui.h
+++ b/libs/pbd/pbd/abstract_ui.h
@@ -58,20 +58,20 @@ class ABSTRACT_UI_API AbstractUI : public BaseUI
AbstractUI (const std::string& name);
virtual ~AbstractUI() {}
- void register_thread (std::string, pthread_t, std::string, uint32_t num_requests);
+ void register_thread (pthread_t, std::string, uint32_t num_requests);
void call_slot (EventLoop::InvalidationRecord*, const boost::function<void()>&);
Glib::Threads::Mutex& slot_invalidation_mutex() { return request_buffer_map_lock; }
Glib::Threads::Mutex request_buffer_map_lock;
+ static void* request_buffer_factory (uint32_t num_requests);
+
protected:
struct RequestBuffer : public PBD::RingBufferNPT<RequestObject> {
bool dead;
- AbstractUI<RequestObject>& ui;
- RequestBuffer (uint32_t size, AbstractUI<RequestObject>& uir)
+ RequestBuffer (uint32_t size)
: PBD::RingBufferNPT<RequestObject> (size)
- , dead (false)
- , ui (uir) {}
+ , dead (false) {}
};
typedef typename RequestBuffer::rw_vector RequestBufferVector;
@@ -105,5 +105,3 @@ class ABSTRACT_UI_API AbstractUI : public BaseUI
};
#endif /* __pbd_abstract_ui_h__ */
-
-