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_THIRD_PARTY_SIGSLOT_SIGSLOT_H_
97 #define RTC_BASE_THIRD_PARTY_SIGSLOT_SIGSLOT_H_
98 
99 #include <cstring>
100 #include <list>
101 #include <set>
102 
103 // On our copy of sigslot.h, we set single threading as default.
104 #define SIGSLOT_DEFAULT_MT_POLICY single_threaded
105 
106 #if defined(SIGSLOT_PURE_ISO) ||                   \
107     (!defined(WEBRTC_WIN) && !defined(__GNUG__) && \
108      !defined(SIGSLOT_USE_POSIX_THREADS))
109 #define _SIGSLOT_SINGLE_THREADED
110 #elif defined(WEBRTC_WIN)
111 #define _SIGSLOT_HAS_WIN32_THREADS
112 #include "windows.h"
113 #elif defined(__GNUG__) || defined(SIGSLOT_USE_POSIX_THREADS)
114 #define _SIGSLOT_HAS_POSIX_THREADS
115 #include <pthread.h>
116 #else
117 #define _SIGSLOT_SINGLE_THREADED
118 #endif
119 
120 #ifndef SIGSLOT_DEFAULT_MT_POLICY
121 #ifdef _SIGSLOT_SINGLE_THREADED
122 #define SIGSLOT_DEFAULT_MT_POLICY single_threaded
123 #else
124 #define SIGSLOT_DEFAULT_MT_POLICY multi_threaded_local
125 #endif
126 #endif
127 
128 // TODO: change this namespace to rtc?
129 namespace sigslot {
130 
131 class single_threaded {
132  public:
lock()133   void lock() {}
unlock()134   void unlock() {}
135 };
136 
137 #ifdef _SIGSLOT_HAS_WIN32_THREADS
138 // The multi threading policies only get compiled in if they are enabled.
139 class multi_threaded_global {
140  public:
multi_threaded_global()141   multi_threaded_global() {
142     static bool isinitialised = false;
143 
144     if (!isinitialised) {
145       InitializeCriticalSection(get_critsec());
146       isinitialised = true;
147     }
148   }
149 
lock()150   void lock() { EnterCriticalSection(get_critsec()); }
151 
unlock()152   void unlock() { LeaveCriticalSection(get_critsec()); }
153 
154  private:
get_critsec()155   CRITICAL_SECTION* get_critsec() {
156     static CRITICAL_SECTION g_critsec;
157     return &g_critsec;
158   }
159 };
160 
161 class multi_threaded_local {
162  public:
multi_threaded_local()163   multi_threaded_local() { InitializeCriticalSection(&m_critsec); }
164 
multi_threaded_local(const multi_threaded_local &)165   multi_threaded_local(const multi_threaded_local&) {
166     InitializeCriticalSection(&m_critsec);
167   }
168 
~multi_threaded_local()169   ~multi_threaded_local() { DeleteCriticalSection(&m_critsec); }
170 
lock()171   void lock() { EnterCriticalSection(&m_critsec); }
172 
unlock()173   void unlock() { LeaveCriticalSection(&m_critsec); }
174 
175  private:
176   CRITICAL_SECTION m_critsec;
177 };
178 #endif  // _SIGSLOT_HAS_WIN32_THREADS
179 
180 #ifdef _SIGSLOT_HAS_POSIX_THREADS
181 #pragma GCC diagnostic push
182 #pragma GCC diagnostic ignored "-Wthread-safety-analysis"
183 // The multi threading policies only get compiled in if they are enabled.
184 class multi_threaded_global {
185  public:
lock()186   void lock() { pthread_mutex_lock(get_mutex()); }
unlock()187   void unlock() { pthread_mutex_unlock(get_mutex()); }
188 
189  private:
190   static pthread_mutex_t* get_mutex();
191 };
192 
193 class multi_threaded_local {
194  public:
multi_threaded_local()195   multi_threaded_local() { pthread_mutex_init(&m_mutex, nullptr); }
multi_threaded_local(const multi_threaded_local &)196   multi_threaded_local(const multi_threaded_local&) {
197     pthread_mutex_init(&m_mutex, nullptr);
198   }
~multi_threaded_local()199   ~multi_threaded_local() { pthread_mutex_destroy(&m_mutex); }
lock()200   void lock() { pthread_mutex_lock(&m_mutex); }
unlock()201   void unlock() { pthread_mutex_unlock(&m_mutex); }
202 
203  private:
204   pthread_mutex_t m_mutex;
205 };
206 #pragma GCC diagnostic pop
207 #endif  // _SIGSLOT_HAS_POSIX_THREADS
208 
209 template <class mt_policy>
210 class lock_block {
211  public:
212   mt_policy* m_mutex;
213 
lock_block(mt_policy * mtx)214   lock_block(mt_policy* mtx) : m_mutex(mtx) { m_mutex->lock(); }
215 
~lock_block()216   ~lock_block() { m_mutex->unlock(); }
217 };
218 
219 class _signal_base_interface;
220 
221 class has_slots_interface {
222  private:
223   typedef void (*signal_connect_t)(has_slots_interface* self,
224                                    _signal_base_interface* sender);
225   typedef void (*signal_disconnect_t)(has_slots_interface* self,
226                                       _signal_base_interface* sender);
227   typedef void (*disconnect_all_t)(has_slots_interface* self);
228 
229   const signal_connect_t m_signal_connect;
230   const signal_disconnect_t m_signal_disconnect;
231   const disconnect_all_t m_disconnect_all;
232 
233  protected:
has_slots_interface(signal_connect_t conn,signal_disconnect_t disc,disconnect_all_t disc_all)234   has_slots_interface(signal_connect_t conn,
235                       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).
~has_slots_interface()243   virtual ~has_slots_interface() {}
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 
~_signal_base_interface()272   ~_signal_base_interface() {}
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)
396         return true;
397       ++it;
398     }
399     return false;
400   }
401 #endif
402 
disconnect(has_slots_interface * pclass)403   void disconnect(has_slots_interface* pclass) {
404     lock_block<mt_policy> lock(this);
405     connections_list::iterator it = m_connected_slots.begin();
406     connections_list::iterator itEnd = m_connected_slots.end();
407 
408     while (it != itEnd) {
409       if (it->getdest() == pclass) {
410         // If we're currently using this iterator because the signal is firing,
411         // advance it to avoid it being invalidated.
412         if (m_current_iterator == it) {
413           m_current_iterator = m_connected_slots.erase(it);
414         } else {
415           m_connected_slots.erase(it);
416         }
417         pclass->signal_disconnect(static_cast<_signal_base_interface*>(this));
418         return;
419       }
420       ++it;
421     }
422   }
423 
424  private:
do_slot_disconnect(_signal_base_interface * p,has_slots_interface * pslot)425   static void do_slot_disconnect(_signal_base_interface* p,
426                                  has_slots_interface* pslot) {
427     _signal_base* const self = static_cast<_signal_base*>(p);
428     lock_block<mt_policy> lock(self);
429     connections_list::iterator it = self->m_connected_slots.begin();
430     connections_list::iterator itEnd = self->m_connected_slots.end();
431 
432     while (it != itEnd) {
433       connections_list::iterator itNext = it;
434       ++itNext;
435 
436       if (it->getdest() == pslot) {
437         // If we're currently using this iterator because the signal is firing,
438         // advance it to avoid it being invalidated.
439         if (self->m_current_iterator == it) {
440           self->m_current_iterator = self->m_connected_slots.erase(it);
441         } else {
442           self->m_connected_slots.erase(it);
443         }
444       }
445 
446       it = itNext;
447     }
448   }
449 
do_slot_duplicate(_signal_base_interface * p,const has_slots_interface * oldtarget,has_slots_interface * newtarget)450   static void do_slot_duplicate(_signal_base_interface* p,
451                                 const has_slots_interface* oldtarget,
452                                 has_slots_interface* newtarget) {
453     _signal_base* const self = static_cast<_signal_base*>(p);
454     lock_block<mt_policy> lock(self);
455     connections_list::iterator it = self->m_connected_slots.begin();
456     connections_list::iterator itEnd = self->m_connected_slots.end();
457 
458     while (it != itEnd) {
459       if (it->getdest() == oldtarget) {
460         self->m_connected_slots.push_back(it->duplicate(newtarget));
461       }
462 
463       ++it;
464     }
465   }
466 
467  protected:
468   connections_list m_connected_slots;
469 
470   // Used to handle a slot being disconnected while a signal is
471   // firing (iterating m_connected_slots).
472   connections_list::iterator m_current_iterator;
473   bool m_erase_current_iterator = false;
474 };
475 
476 template <class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
477 class has_slots : public has_slots_interface, public mt_policy {
478  private:
479   typedef std::set<_signal_base_interface*> sender_set;
480   typedef sender_set::const_iterator const_iterator;
481 
482  public:
has_slots()483   has_slots()
484       : has_slots_interface(&has_slots::do_signal_connect,
485                             &has_slots::do_signal_disconnect,
486                             &has_slots::do_disconnect_all) {}
487 
has_slots(has_slots const & o)488   has_slots(has_slots const& o)
489       : has_slots_interface(&has_slots::do_signal_connect,
490                             &has_slots::do_signal_disconnect,
491                             &has_slots::do_disconnect_all) {
492     lock_block<mt_policy> lock(this);
493     for (auto* sender : o.m_senders) {
494       sender->slot_duplicate(&o, this);
495       m_senders.insert(sender);
496     }
497   }
498 
~has_slots()499   ~has_slots() { this->disconnect_all(); }
500 
501  private:
502   has_slots& operator=(has_slots const&);
503 
do_signal_connect(has_slots_interface * p,_signal_base_interface * sender)504   static void do_signal_connect(has_slots_interface* p,
505                                 _signal_base_interface* sender) {
506     has_slots* const self = static_cast<has_slots*>(p);
507     lock_block<mt_policy> lock(self);
508     self->m_senders.insert(sender);
509   }
510 
do_signal_disconnect(has_slots_interface * p,_signal_base_interface * sender)511   static void do_signal_disconnect(has_slots_interface* p,
512                                    _signal_base_interface* sender) {
513     has_slots* const self = static_cast<has_slots*>(p);
514     lock_block<mt_policy> lock(self);
515     self->m_senders.erase(sender);
516   }
517 
do_disconnect_all(has_slots_interface * p)518   static void do_disconnect_all(has_slots_interface* p) {
519     has_slots* const self = static_cast<has_slots*>(p);
520     lock_block<mt_policy> lock(self);
521     while (!self->m_senders.empty()) {
522       std::set<_signal_base_interface*> senders;
523       senders.swap(self->m_senders);
524       const_iterator it = senders.begin();
525       const_iterator itEnd = senders.end();
526 
527       while (it != itEnd) {
528         _signal_base_interface* s = *it;
529         ++it;
530         s->slot_disconnect(p);
531       }
532     }
533   }
534 
535  private:
536   sender_set m_senders;
537 };
538 
539 template <class mt_policy, typename... Args>
540 class signal_with_thread_policy : public _signal_base<mt_policy> {
541  private:
542   typedef _signal_base<mt_policy> base;
543 
544  protected:
545   typedef typename base::connections_list connections_list;
546 
547  public:
signal_with_thread_policy()548   signal_with_thread_policy() {}
549 
550   template <class desttype>
connect(desttype * pclass,void (desttype::* pmemfun)(Args...))551   void connect(desttype* pclass, void (desttype::*pmemfun)(Args...)) {
552     lock_block<mt_policy> lock(this);
553     this->m_connected_slots.push_back(_opaque_connection(pclass, pmemfun));
554     pclass->signal_connect(static_cast<_signal_base_interface*>(this));
555   }
556 
emit(Args...args)557   void emit(Args... args) {
558     lock_block<mt_policy> lock(this);
559     this->m_current_iterator = this->m_connected_slots.begin();
560     while (this->m_current_iterator != this->m_connected_slots.end()) {
561       _opaque_connection const& conn = *this->m_current_iterator;
562       ++(this->m_current_iterator);
563       conn.emit<Args...>(args...);
564     }
565   }
566 
operator()567   void operator()(Args... args) { emit(args...); }
568 };
569 
570 // Alias with default thread policy. Needed because both default arguments
571 // and variadic template arguments must go at the end of the list, so we
572 // can't have both at once.
573 template <typename... Args>
574 using signal = signal_with_thread_policy<SIGSLOT_DEFAULT_MT_POLICY, Args...>;
575 
576 // The previous verion of sigslot didn't use variadic templates, so you would
577 // need to write "sigslot::signal2<Arg1, Arg2>", for example.
578 // Now you can just write "sigslot::signal<Arg1, Arg2>", but these aliases
579 // exist for backwards compatibility.
580 template <typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
581 using signal0 = signal_with_thread_policy<mt_policy>;
582 
583 template <typename A1, typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
584 using signal1 = signal_with_thread_policy<mt_policy, A1>;
585 
586 template <typename A1,
587           typename A2,
588           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
589 using signal2 = signal_with_thread_policy<mt_policy, A1, A2>;
590 
591 template <typename A1,
592           typename A2,
593           typename A3,
594           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
595 using signal3 = signal_with_thread_policy<mt_policy, A1, A2, A3>;
596 
597 template <typename A1,
598           typename A2,
599           typename A3,
600           typename A4,
601           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
602 using signal4 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4>;
603 
604 template <typename A1,
605           typename A2,
606           typename A3,
607           typename A4,
608           typename A5,
609           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
610 using signal5 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5>;
611 
612 template <typename A1,
613           typename A2,
614           typename A3,
615           typename A4,
616           typename A5,
617           typename A6,
618           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
619 using signal6 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6>;
620 
621 template <typename A1,
622           typename A2,
623           typename A3,
624           typename A4,
625           typename A5,
626           typename A6,
627           typename A7,
628           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
629 using signal7 =
630     signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6, A7>;
631 
632 template <typename A1,
633           typename A2,
634           typename A3,
635           typename A4,
636           typename A5,
637           typename A6,
638           typename A7,
639           typename A8,
640           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
641 using signal8 =
642     signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6, A7, A8>;
643 
644 }  // namespace sigslot
645 
646 #endif /* RTC_BASE_THIRD_PARTY_SIGSLOT_SIGSLOT_H_ */
647