1 // sigslot.h: Signal/Slot classes
2 //
3 // Written by Sarah Thompson (sarah@telergy.com) 2002.
4 //
5 // License: Public domain. You are free to use this code however you like, with
6 // the proviso that the author takes on no responsibility or liability for any
7 // use.
8 //
9 // QUICK DOCUMENTATION
10 //
11 //        (see also the full documentation at http://sigslot.sourceforge.net/)
12 //
13 //    #define switches
14 //      SIGSLOT_PURE_ISO:
15 //        Define this to force ISO C++ compliance. This also disables all of
16 //        the thread safety support on platforms where it is available.
17 //
18 //      SIGSLOT_USE_POSIX_THREADS:
19 //        Force use of Posix threads when using a C++ compiler other than gcc
20 //        on a platform that supports Posix threads. (When using gcc, this is
21 //        the default - use SIGSLOT_PURE_ISO to disable this if necessary)
22 //
23 //      SIGSLOT_DEFAULT_MT_POLICY:
24 //        Where thread support is enabled, this defaults to
25 //        multi_threaded_global. Otherwise, the default is single_threaded.
26 //        #define this yourself to override the default. In pure ISO mode,
27 //        anything other than single_threaded will cause a compiler error.
28 //
29 //    PLATFORM NOTES
30 //
31 //      Win32:
32 //        On Win32, the WEBRTC_WIN symbol must be #defined. Most mainstream
33 //        compilers do this by default, but you may need to define it yourself
34 //        if your build environment is less standard. This causes the Win32
35 //        thread support to be compiled in and used automatically.
36 //
37 //      Unix/Linux/BSD, etc.:
38 //        If you're using gcc, it is assumed that you have Posix threads
39 //        available, so they are used automatically. You can override this (as
40 //        under Windows) with the SIGSLOT_PURE_ISO switch. If you're using
41 //        something other than gcc but still want to use Posix threads, you
42 //        need to #define SIGSLOT_USE_POSIX_THREADS.
43 //
44 //      ISO C++:
45 //        If none of the supported platforms are detected, or if
46 //        SIGSLOT_PURE_ISO is defined, all multithreading support is turned
47 //        off, along with any code that might cause a pure ISO C++ environment
48 //        to complain. Before you ask, gcc -ansi -pedantic won't compile this
49 //        library, but gcc -ansi is fine. Pedantic mode seems to throw a lot of
50 //        errors that aren't really there. If you feel like investigating this,
51 //        please contact the author.
52 //
53 //
54 //    THREADING MODES
55 //
56 //      single_threaded:
57 //        Your program is assumed to be single threaded from the point of view
58 //        of signal/slot usage (i.e. all objects using signals and slots are
59 //        created and destroyed from a single thread). Behaviour if objects are
60 //        destroyed concurrently is undefined (i.e. you'll get the occasional
61 //        segmentation fault/memory exception).
62 //
63 //      multi_threaded_global:
64 //        Your program is assumed to be multi threaded. Objects using signals
65 //        and slots can be safely created and destroyed from any thread, even
66 //        when connections exist. In multi_threaded_global mode, this is
67 //        achieved by a single global mutex (actually a critical section on
68 //        Windows because they are faster). This option uses less OS resources,
69 //        but results in more opportunities for contention, possibly resulting
70 //        in more context switches than are strictly necessary.
71 //
72 //      multi_threaded_local:
73 //        Behaviour in this mode is essentially the same as
74 //        multi_threaded_global, except that each signal, and each object that
75 //        inherits has_slots, all have their own mutex/critical section. In
76 //        practice, this means that mutex collisions (and hence context
77 //        switches) only happen if they are absolutely essential. However, on
78 //        some platforms, creating a lot of mutexes can slow down the whole OS,
79 //        so use this option with care.
80 //
81 //    USING THE LIBRARY
82 //
83 //      See the full documentation at http://sigslot.sourceforge.net/
84 //
85 // Libjingle specific:
86 //
87 // This file has been modified such that has_slots and signalx do not have to be
88 // using the same threading requirements. E.g. it is possible to connect a
89 // has_slots<single_threaded> and signal0<multi_threaded_local> or
90 // has_slots<multi_threaded_local> and signal0<single_threaded>.
91 // If has_slots is single threaded the user must ensure that it is not trying
92 // to connect or disconnect to signalx concurrently or data race may occur.
93 // If signalx is single threaded the user must ensure that disconnect, connect
94 // or signal is not happening concurrently or data race may occur.
95 
96 #ifndef RTC_BASE_SIGSLOT_H_
97 #define RTC_BASE_SIGSLOT_H_
98 
99 #include <stdlib.h>
100 #include <cstring>
101 #include <list>
102 #include <set>
103 
104 // On our copy of sigslot.h, we set single threading as default.
105 #define SIGSLOT_DEFAULT_MT_POLICY single_threaded
106 
107 #if defined(SIGSLOT_PURE_ISO) ||                   \
108     (!defined(WEBRTC_WIN) && !defined(__GNUG__) && \
109      !defined(SIGSLOT_USE_POSIX_THREADS))
110 #  define _SIGSLOT_SINGLE_THREADED
111 #elif defined(WEBRTC_WIN)
112 #  define _SIGSLOT_HAS_WIN32_THREADS
113 #  if !defined(WIN32_LEAN_AND_MEAN)
114 #    define WIN32_LEAN_AND_MEAN
115 #  endif
116 #  include "rtc_base/win32.h"
117 #elif defined(__GNUG__) || defined(SIGSLOT_USE_POSIX_THREADS)
118 #  define _SIGSLOT_HAS_POSIX_THREADS
119 #  include <pthread.h>
120 #else
121 #  define _SIGSLOT_SINGLE_THREADED
122 #endif
123 
124 #ifndef SIGSLOT_DEFAULT_MT_POLICY
125 #  ifdef _SIGSLOT_SINGLE_THREADED
126 #    define SIGSLOT_DEFAULT_MT_POLICY single_threaded
127 #  else
128 #    define SIGSLOT_DEFAULT_MT_POLICY multi_threaded_local
129 #  endif
130 #endif
131 
132 // TODO: change this namespace to rtc?
133 namespace sigslot {
134 
135 class single_threaded {
136  public:
lock()137   void lock() {}
unlock()138   void unlock() {}
139 };
140 
141 #ifdef _SIGSLOT_HAS_WIN32_THREADS
142 // The multi threading policies only get compiled in if they are enabled.
143 class multi_threaded_global {
144  public:
multi_threaded_global()145   multi_threaded_global() {
146     static bool isinitialised = false;
147 
148     if (!isinitialised) {
149       InitializeCriticalSection(get_critsec());
150       isinitialised = true;
151     }
152   }
153 
lock()154   void lock() { EnterCriticalSection(get_critsec()); }
155 
unlock()156   void unlock() { LeaveCriticalSection(get_critsec()); }
157 
158  private:
get_critsec()159   CRITICAL_SECTION* get_critsec() {
160     static CRITICAL_SECTION g_critsec;
161     return &g_critsec;
162   }
163 };
164 
165 class multi_threaded_local {
166  public:
multi_threaded_local()167   multi_threaded_local() { InitializeCriticalSection(&m_critsec); }
168 
multi_threaded_local(const multi_threaded_local &)169   multi_threaded_local(const multi_threaded_local&) {
170     InitializeCriticalSection(&m_critsec);
171   }
172 
~multi_threaded_local()173   ~multi_threaded_local() { DeleteCriticalSection(&m_critsec); }
174 
lock()175   void lock() { EnterCriticalSection(&m_critsec); }
176 
unlock()177   void unlock() { LeaveCriticalSection(&m_critsec); }
178 
179  private:
180   CRITICAL_SECTION m_critsec;
181 };
182 #endif  // _SIGSLOT_HAS_WIN32_THREADS
183 
184 #ifdef _SIGSLOT_HAS_POSIX_THREADS
185 // The multi threading policies only get compiled in if they are enabled.
186 class multi_threaded_global {
187  public:
lock()188   void lock() { pthread_mutex_lock(get_mutex()); }
unlock()189   void unlock() { pthread_mutex_unlock(get_mutex()); }
190 
191  private:
192   static pthread_mutex_t* get_mutex();
193 };
194 
195 class multi_threaded_local {
196  public:
multi_threaded_local()197   multi_threaded_local() { pthread_mutex_init(&m_mutex, nullptr); }
multi_threaded_local(const multi_threaded_local &)198   multi_threaded_local(const multi_threaded_local&) {
199     pthread_mutex_init(&m_mutex, nullptr);
200   }
~multi_threaded_local()201   ~multi_threaded_local() { pthread_mutex_destroy(&m_mutex); }
lock()202   void lock() { pthread_mutex_lock(&m_mutex); }
unlock()203   void unlock() { pthread_mutex_unlock(&m_mutex); }
204 
205  private:
206   pthread_mutex_t m_mutex;
207 };
208 #endif  // _SIGSLOT_HAS_POSIX_THREADS
209 
210 template <class mt_policy>
211 class lock_block {
212  public:
213   mt_policy* m_mutex;
214 
lock_block(mt_policy * mtx)215   explicit lock_block(mt_policy* mtx) : m_mutex(mtx) { m_mutex->lock(); }
216 
~lock_block()217   ~lock_block() { m_mutex->unlock(); }
218 };
219 
220 class _signal_base_interface;
221 
222 class has_slots_interface {
223  private:
224   typedef void (*signal_connect_t)(has_slots_interface* self,
225                                    _signal_base_interface* sender);
226   typedef void (*signal_disconnect_t)(has_slots_interface* self,
227                                       _signal_base_interface* sender);
228   typedef void (*disconnect_all_t)(has_slots_interface* self);
229 
230   const signal_connect_t m_signal_connect;
231   const signal_disconnect_t m_signal_disconnect;
232   const disconnect_all_t m_disconnect_all;
233 
234  protected:
has_slots_interface(signal_connect_t conn,signal_disconnect_t disc,disconnect_all_t disc_all)235   has_slots_interface(signal_connect_t conn, signal_disconnect_t disc,
236                       disconnect_all_t disc_all)
237       : m_signal_connect(conn),
238         m_signal_disconnect(disc),
239         m_disconnect_all(disc_all) {}
240 
241   // Doesn't really need to be virtual, but is for backwards compatibility
242   // (it was virtual in a previous version of sigslot).
243   virtual ~has_slots_interface() = default;
244 
245  public:
signal_connect(_signal_base_interface * sender)246   void signal_connect(_signal_base_interface* sender) {
247     m_signal_connect(this, sender);
248   }
249 
signal_disconnect(_signal_base_interface * sender)250   void signal_disconnect(_signal_base_interface* sender) {
251     m_signal_disconnect(this, sender);
252   }
253 
disconnect_all()254   void disconnect_all() { m_disconnect_all(this); }
255 };
256 
257 class _signal_base_interface {
258  private:
259   typedef void (*slot_disconnect_t)(_signal_base_interface* self,
260                                     has_slots_interface* pslot);
261   typedef void (*slot_duplicate_t)(_signal_base_interface* self,
262                                    const has_slots_interface* poldslot,
263                                    has_slots_interface* pnewslot);
264 
265   const slot_disconnect_t m_slot_disconnect;
266   const slot_duplicate_t m_slot_duplicate;
267 
268  protected:
_signal_base_interface(slot_disconnect_t disc,slot_duplicate_t dupl)269   _signal_base_interface(slot_disconnect_t disc, slot_duplicate_t dupl)
270       : m_slot_disconnect(disc), m_slot_duplicate(dupl) {}
271 
272   ~_signal_base_interface() = default;
273 
274  public:
slot_disconnect(has_slots_interface * pslot)275   void slot_disconnect(has_slots_interface* pslot) {
276     m_slot_disconnect(this, pslot);
277   }
278 
slot_duplicate(const has_slots_interface * poldslot,has_slots_interface * pnewslot)279   void slot_duplicate(const has_slots_interface* poldslot,
280                       has_slots_interface* pnewslot) {
281     m_slot_duplicate(this, poldslot, pnewslot);
282   }
283 };
284 
285 class _opaque_connection {
286  private:
287   typedef void (*emit_t)(const _opaque_connection*);
288   template <typename FromT, typename ToT>
289   union union_caster {
290     FromT from;
291     ToT to;
292   };
293 
294   emit_t pemit;
295   has_slots_interface* pdest;
296   // Pointers to member functions may be up to 16 bytes for virtual classes,
297   // so make sure we have enough space to store it.
298   unsigned char pmethod[16];
299 
300  public:
301   template <typename DestT, typename... Args>
_opaque_connection(DestT * pd,void (DestT::* pm)(Args...))302   _opaque_connection(DestT* pd, void (DestT::*pm)(Args...)) : pdest(pd) {
303     typedef void (DestT::*pm_t)(Args...);
304     static_assert(sizeof(pm_t) <= sizeof(pmethod),
305                   "Size of slot function pointer too large.");
306 
307     std::memcpy(pmethod, &pm, sizeof(pm_t));
308 
309     typedef void (*em_t)(const _opaque_connection* self, Args...);
310     union_caster<em_t, emit_t> caster2;
311     caster2.from = &_opaque_connection::emitter<DestT, Args...>;
312     pemit = caster2.to;
313   }
314 
getdest()315   has_slots_interface* getdest() const { return pdest; }
316 
duplicate(has_slots_interface * newtarget)317   _opaque_connection duplicate(has_slots_interface* newtarget) const {
318     _opaque_connection res = *this;
319     res.pdest = newtarget;
320     return res;
321   }
322 
323   // Just calls the stored "emitter" function pointer stored at construction
324   // time.
325   template <typename... Args>
emit(Args...args)326   void emit(Args... args) const {
327     typedef void (*em_t)(const _opaque_connection*, Args...);
328     union_caster<emit_t, em_t> caster;
329     caster.from = pemit;
330     (caster.to)(this, args...);
331   }
332 
333  private:
334   template <typename DestT, typename... Args>
emitter(const _opaque_connection * self,Args...args)335   static void emitter(const _opaque_connection* self, Args... args) {
336     typedef void (DestT::*pm_t)(Args...);
337     pm_t pm;
338     std::memcpy(&pm, self->pmethod, sizeof(pm_t));
339     (static_cast<DestT*>(self->pdest)->*(pm))(args...);
340   }
341 };
342 
343 template <class mt_policy>
344 class _signal_base : public _signal_base_interface, public mt_policy {
345  protected:
346   typedef std::list<_opaque_connection> connections_list;
347 
_signal_base()348   _signal_base()
349       : _signal_base_interface(&_signal_base::do_slot_disconnect,
350                                &_signal_base::do_slot_duplicate),
351         m_current_iterator(m_connected_slots.end()) {}
352 
~_signal_base()353   ~_signal_base() { disconnect_all(); }
354 
355  private:
356   _signal_base& operator=(_signal_base const& that);
357 
358  public:
_signal_base(const _signal_base & o)359   _signal_base(const _signal_base& o)
360       : _signal_base_interface(&_signal_base::do_slot_disconnect,
361                                &_signal_base::do_slot_duplicate),
362         m_current_iterator(m_connected_slots.end()) {
363     lock_block<mt_policy> lock(this);
364     for (const auto& connection : o.m_connected_slots) {
365       connection.getdest()->signal_connect(this);
366       m_connected_slots.push_back(connection);
367     }
368   }
369 
is_empty()370   bool is_empty() {
371     lock_block<mt_policy> lock(this);
372     return m_connected_slots.empty();
373   }
374 
disconnect_all()375   void disconnect_all() {
376     lock_block<mt_policy> lock(this);
377 
378     while (!m_connected_slots.empty()) {
379       has_slots_interface* pdest = m_connected_slots.front().getdest();
380       m_connected_slots.pop_front();
381       pdest->signal_disconnect(static_cast<_signal_base_interface*>(this));
382     }
383     // If disconnect_all is called while the signal is firing, advance the
384     // current slot iterator to the end to avoid an invalidated iterator from
385     // being dereferenced.
386     m_current_iterator = m_connected_slots.end();
387   }
388 
389 #if !defined(NDEBUG)
connected(has_slots_interface * pclass)390   bool connected(has_slots_interface* pclass) {
391     lock_block<mt_policy> lock(this);
392     connections_list::const_iterator it = m_connected_slots.begin();
393     connections_list::const_iterator itEnd = m_connected_slots.end();
394     while (it != itEnd) {
395       if (it->getdest() == pclass) return true;
396       ++it;
397     }
398     return false;
399   }
400 #endif
401 
disconnect(has_slots_interface * pclass)402   void disconnect(has_slots_interface* pclass) {
403     lock_block<mt_policy> lock(this);
404     connections_list::iterator it = m_connected_slots.begin();
405     connections_list::iterator itEnd = m_connected_slots.end();
406 
407     while (it != itEnd) {
408       if (it->getdest() == pclass) {
409         // If we're currently using this iterator because the signal is firing,
410         // advance it to avoid it being invalidated.
411         if (m_current_iterator == it) {
412           m_current_iterator = m_connected_slots.erase(it);
413         } else {
414           m_connected_slots.erase(it);
415         }
416         pclass->signal_disconnect(static_cast<_signal_base_interface*>(this));
417         return;
418       }
419       ++it;
420     }
421   }
422 
423  private:
do_slot_disconnect(_signal_base_interface * p,has_slots_interface * pslot)424   static void do_slot_disconnect(_signal_base_interface* p,
425                                  has_slots_interface* pslot) {
426     _signal_base* const self = static_cast<_signal_base*>(p);
427     lock_block<mt_policy> lock(self);
428     connections_list::iterator it = self->m_connected_slots.begin();
429     connections_list::iterator itEnd = self->m_connected_slots.end();
430 
431     while (it != itEnd) {
432       connections_list::iterator itNext = it;
433       ++itNext;
434 
435       if (it->getdest() == pslot) {
436         // If we're currently using this iterator because the signal is firing,
437         // advance it to avoid it being invalidated.
438         if (self->m_current_iterator == it) {
439           self->m_current_iterator = self->m_connected_slots.erase(it);
440         } else {
441           self->m_connected_slots.erase(it);
442         }
443       }
444 
445       it = itNext;
446     }
447   }
448 
do_slot_duplicate(_signal_base_interface * p,const has_slots_interface * oldtarget,has_slots_interface * newtarget)449   static void do_slot_duplicate(_signal_base_interface* p,
450                                 const has_slots_interface* oldtarget,
451                                 has_slots_interface* newtarget) {
452     _signal_base* const self = static_cast<_signal_base*>(p);
453     lock_block<mt_policy> lock(self);
454     connections_list::iterator it = self->m_connected_slots.begin();
455     connections_list::iterator itEnd = self->m_connected_slots.end();
456 
457     while (it != itEnd) {
458       if (it->getdest() == oldtarget) {
459         self->m_connected_slots.push_back(it->duplicate(newtarget));
460       }
461 
462       ++it;
463     }
464   }
465 
466  protected:
467   connections_list m_connected_slots;
468 
469   // Used to handle a slot being disconnected while a signal is
470   // firing (iterating m_connected_slots).
471   connections_list::iterator m_current_iterator;
472   bool m_erase_current_iterator = false;
473 };
474 
475 template <class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
476 class has_slots : public has_slots_interface, public mt_policy {
477  private:
478   typedef std::set<_signal_base_interface*> sender_set;
479   typedef sender_set::const_iterator const_iterator;
480 
481  public:
has_slots()482   has_slots()
483       : has_slots_interface(&has_slots::do_signal_connect,
484                             &has_slots::do_signal_disconnect,
485                             &has_slots::do_disconnect_all) {}
486 
has_slots(has_slots const & o)487   has_slots(has_slots const& o)
488       : has_slots_interface(&has_slots::do_signal_connect,
489                             &has_slots::do_signal_disconnect,
490                             &has_slots::do_disconnect_all) {
491     lock_block<mt_policy> lock(this);
492     for (auto* sender : o.m_senders) {
493       sender->slot_duplicate(&o, this);
494       m_senders.insert(sender);
495     }
496   }
497 
~has_slots()498   ~has_slots() { this->disconnect_all(); }
499 
500  private:
501   has_slots& operator=(has_slots const&);
502 
do_signal_connect(has_slots_interface * p,_signal_base_interface * sender)503   static void do_signal_connect(has_slots_interface* p,
504                                 _signal_base_interface* sender) {
505     has_slots* const self = static_cast<has_slots*>(p);
506     lock_block<mt_policy> lock(self);
507     self->m_senders.insert(sender);
508   }
509 
do_signal_disconnect(has_slots_interface * p,_signal_base_interface * sender)510   static void do_signal_disconnect(has_slots_interface* p,
511                                    _signal_base_interface* sender) {
512     has_slots* const self = static_cast<has_slots*>(p);
513     lock_block<mt_policy> lock(self);
514     self->m_senders.erase(sender);
515   }
516 
do_disconnect_all(has_slots_interface * p)517   static void do_disconnect_all(has_slots_interface* p) {
518     has_slots* const self = static_cast<has_slots*>(p);
519     lock_block<mt_policy> lock(self);
520     while (!self->m_senders.empty()) {
521       std::set<_signal_base_interface*> senders;
522       senders.swap(self->m_senders);
523       const_iterator it = senders.begin();
524       const_iterator itEnd = senders.end();
525 
526       while (it != itEnd) {
527         _signal_base_interface* s = *it;
528         ++it;
529         s->slot_disconnect(p);
530       }
531     }
532   }
533 
534  private:
535   sender_set m_senders;
536 };
537 
538 template <class mt_policy, typename... Args>
539 class signal_with_thread_policy : public _signal_base<mt_policy> {
540  private:
541   typedef _signal_base<mt_policy> base;
542 
543  protected:
544   typedef typename base::connections_list connections_list;
545 
546  public:
547   signal_with_thread_policy() = default;
548 
549   template <class desttype>
connect(desttype * pclass,void (desttype::* pmemfun)(Args...))550   void connect(desttype* pclass, void (desttype::*pmemfun)(Args...)) {
551     lock_block<mt_policy> lock(this);
552     this->m_connected_slots.push_back(_opaque_connection(pclass, pmemfun));
553     pclass->signal_connect(static_cast<_signal_base_interface*>(this));
554   }
555 
emit(Args...args)556   void emit(Args... args) {
557     lock_block<mt_policy> lock(this);
558     this->m_current_iterator = this->m_connected_slots.begin();
559     while (this->m_current_iterator != this->m_connected_slots.end()) {
560       _opaque_connection const& conn = *this->m_current_iterator;
561       ++(this->m_current_iterator);
562       conn.emit<Args...>(args...);
563     }
564   }
565 
operator()566   void operator()(Args... args) { emit(args...); }
567 };
568 
569 // Alias with default thread policy. Needed because both default arguments
570 // and variadic template arguments must go at the end of the list, so we
571 // can't have both at once.
572 template <typename... Args>
573 using signal = signal_with_thread_policy<SIGSLOT_DEFAULT_MT_POLICY, Args...>;
574 
575 // The previous verion of sigslot didn't use variadic templates, so you would
576 // need to write "sigslot::signal2<Arg1, Arg2>", for example.
577 // Now you can just write "sigslot::signal<Arg1, Arg2>", but these aliases
578 // exist for backwards compatibility.
579 template <typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
580 using signal0 = signal_with_thread_policy<mt_policy>;
581 
582 template <typename A1, typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
583 using signal1 = signal_with_thread_policy<mt_policy, A1>;
584 
585 template <typename A1, typename A2,
586           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
587 using signal2 = signal_with_thread_policy<mt_policy, A1, A2>;
588 
589 template <typename A1, typename A2, typename A3,
590           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
591 using signal3 = signal_with_thread_policy<mt_policy, A1, A2, A3>;
592 
593 template <typename A1, typename A2, typename A3, typename A4,
594           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
595 using signal4 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4>;
596 
597 template <typename A1, typename A2, typename A3, typename A4, typename A5,
598           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
599 using signal5 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5>;
600 
601 template <typename A1, typename A2, typename A3, typename A4, typename A5,
602           typename A6, typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
603 using signal6 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6>;
604 
605 template <typename A1, typename A2, typename A3, typename A4, typename A5,
606           typename A6, typename A7,
607           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
608 using signal7 =
609     signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6, A7>;
610 
611 template <typename A1, typename A2, typename A3, typename A4, typename A5,
612           typename A6, typename A7, typename A8,
613           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
614 using signal8 =
615     signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6, A7, A8>;
616 
617 }  // namespace sigslot
618 
619 #endif  // RTC_BASE_SIGSLOT_H_
620