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 // The multi threading policies only get compiled in if they are enabled.
182 class multi_threaded_global {
183  public:
lock()184   void lock() { pthread_mutex_lock(get_mutex()); }
unlock()185   void unlock() { pthread_mutex_unlock(get_mutex()); }
186 
187  private:
188   static pthread_mutex_t* get_mutex();
189 };
190 
191 class multi_threaded_local {
192  public:
multi_threaded_local()193   multi_threaded_local() { pthread_mutex_init(&m_mutex, nullptr); }
multi_threaded_local(const multi_threaded_local &)194   multi_threaded_local(const multi_threaded_local&) {
195     pthread_mutex_init(&m_mutex, nullptr);
196   }
~multi_threaded_local()197   ~multi_threaded_local() { pthread_mutex_destroy(&m_mutex); }
lock()198   void lock() { pthread_mutex_lock(&m_mutex); }
unlock()199   void unlock() { pthread_mutex_unlock(&m_mutex); }
200 
201  private:
202   pthread_mutex_t m_mutex;
203 };
204 #endif  // _SIGSLOT_HAS_POSIX_THREADS
205 
206 template <class mt_policy>
207 class lock_block {
208  public:
209   mt_policy* m_mutex;
210 
lock_block(mt_policy * mtx)211   lock_block(mt_policy* mtx) : m_mutex(mtx) { m_mutex->lock(); }
212 
~lock_block()213   ~lock_block() { m_mutex->unlock(); }
214 };
215 
216 class _signal_base_interface;
217 
218 class has_slots_interface {
219  private:
220   typedef void (*signal_connect_t)(has_slots_interface* self,
221                                    _signal_base_interface* sender);
222   typedef void (*signal_disconnect_t)(has_slots_interface* self,
223                                       _signal_base_interface* sender);
224   typedef void (*disconnect_all_t)(has_slots_interface* self);
225 
226   const signal_connect_t m_signal_connect;
227   const signal_disconnect_t m_signal_disconnect;
228   const disconnect_all_t m_disconnect_all;
229 
230  protected:
has_slots_interface(signal_connect_t conn,signal_disconnect_t disc,disconnect_all_t disc_all)231   has_slots_interface(signal_connect_t conn,
232                       signal_disconnect_t disc,
233                       disconnect_all_t disc_all)
234       : m_signal_connect(conn),
235         m_signal_disconnect(disc),
236         m_disconnect_all(disc_all) {}
237 
238   // Doesn't really need to be virtual, but is for backwards compatibility
239   // (it was virtual in a previous version of sigslot).
~has_slots_interface()240   virtual ~has_slots_interface() {}
241 
242  public:
signal_connect(_signal_base_interface * sender)243   void signal_connect(_signal_base_interface* sender) {
244     m_signal_connect(this, sender);
245   }
246 
signal_disconnect(_signal_base_interface * sender)247   void signal_disconnect(_signal_base_interface* sender) {
248     m_signal_disconnect(this, sender);
249   }
250 
disconnect_all()251   void disconnect_all() { m_disconnect_all(this); }
252 };
253 
254 class _signal_base_interface {
255  private:
256   typedef void (*slot_disconnect_t)(_signal_base_interface* self,
257                                     has_slots_interface* pslot);
258   typedef void (*slot_duplicate_t)(_signal_base_interface* self,
259                                    const has_slots_interface* poldslot,
260                                    has_slots_interface* pnewslot);
261 
262   const slot_disconnect_t m_slot_disconnect;
263   const slot_duplicate_t m_slot_duplicate;
264 
265  protected:
_signal_base_interface(slot_disconnect_t disc,slot_duplicate_t dupl)266   _signal_base_interface(slot_disconnect_t disc, slot_duplicate_t dupl)
267       : m_slot_disconnect(disc), m_slot_duplicate(dupl) {}
268 
~_signal_base_interface()269   ~_signal_base_interface() {}
270 
271  public:
slot_disconnect(has_slots_interface * pslot)272   void slot_disconnect(has_slots_interface* pslot) {
273     m_slot_disconnect(this, pslot);
274   }
275 
slot_duplicate(const has_slots_interface * poldslot,has_slots_interface * pnewslot)276   void slot_duplicate(const has_slots_interface* poldslot,
277                       has_slots_interface* pnewslot) {
278     m_slot_duplicate(this, poldslot, pnewslot);
279   }
280 };
281 
282 class _opaque_connection {
283  private:
284   typedef void (*emit_t)(const _opaque_connection*);
285   template <typename FromT, typename ToT>
286   union union_caster {
287     FromT from;
288     ToT to;
289   };
290 
291   emit_t pemit;
292   has_slots_interface* pdest;
293   // Pointers to member functions may be up to 16 bytes for virtual classes,
294   // so make sure we have enough space to store it.
295   unsigned char pmethod[16];
296 
297  public:
298   template <typename DestT, typename... Args>
_opaque_connection(DestT * pd,void (DestT::* pm)(Args...))299   _opaque_connection(DestT* pd, void (DestT::*pm)(Args...)) : pdest(pd) {
300     typedef void (DestT::*pm_t)(Args...);
301     static_assert(sizeof(pm_t) <= sizeof(pmethod),
302                   "Size of slot function pointer too large.");
303 
304     std::memcpy(pmethod, &pm, sizeof(pm_t));
305 
306     typedef void (*em_t)(const _opaque_connection* self, Args...);
307     union_caster<em_t, emit_t> caster2;
308     caster2.from = &_opaque_connection::emitter<DestT, Args...>;
309     pemit = caster2.to;
310   }
311 
getdest()312   has_slots_interface* getdest() const { return pdest; }
313 
duplicate(has_slots_interface * newtarget)314   _opaque_connection duplicate(has_slots_interface* newtarget) const {
315     _opaque_connection res = *this;
316     res.pdest = newtarget;
317     return res;
318   }
319 
320   // Just calls the stored "emitter" function pointer stored at construction
321   // time.
322   template <typename... Args>
emit(Args...args)323   void emit(Args... args) const {
324     typedef void (*em_t)(const _opaque_connection*, Args...);
325     union_caster<emit_t, em_t> caster;
326     caster.from = pemit;
327     (caster.to)(this, args...);
328   }
329 
330  private:
331   template <typename DestT, typename... Args>
emitter(const _opaque_connection * self,Args...args)332   static void emitter(const _opaque_connection* self, Args... args) {
333     typedef void (DestT::*pm_t)(Args...);
334     pm_t pm;
335     std::memcpy(&pm, self->pmethod, sizeof(pm_t));
336     (static_cast<DestT*>(self->pdest)->*(pm))(args...);
337   }
338 };
339 
340 template <class mt_policy>
341 class _signal_base : public _signal_base_interface, public mt_policy {
342  protected:
343   typedef std::list<_opaque_connection> connections_list;
344 
_signal_base()345   _signal_base()
346       : _signal_base_interface(&_signal_base::do_slot_disconnect,
347                                &_signal_base::do_slot_duplicate),
348         m_current_iterator(m_connected_slots.end()) {}
349 
~_signal_base()350   ~_signal_base() { disconnect_all(); }
351 
352  private:
353   _signal_base& operator=(_signal_base const& that);
354 
355  public:
_signal_base(const _signal_base & o)356   _signal_base(const _signal_base& o)
357       : _signal_base_interface(&_signal_base::do_slot_disconnect,
358                                &_signal_base::do_slot_duplicate),
359         m_current_iterator(m_connected_slots.end()) {
360     lock_block<mt_policy> lock(this);
361     for (const auto& connection : o.m_connected_slots) {
362       connection.getdest()->signal_connect(this);
363       m_connected_slots.push_back(connection);
364     }
365   }
366 
is_empty()367   bool is_empty() {
368     lock_block<mt_policy> lock(this);
369     return m_connected_slots.empty();
370   }
371 
disconnect_all()372   void disconnect_all() {
373     lock_block<mt_policy> lock(this);
374 
375     while (!m_connected_slots.empty()) {
376       has_slots_interface* pdest = m_connected_slots.front().getdest();
377       m_connected_slots.pop_front();
378       pdest->signal_disconnect(static_cast<_signal_base_interface*>(this));
379     }
380     // If disconnect_all is called while the signal is firing, advance the
381     // current slot iterator to the end to avoid an invalidated iterator from
382     // being dereferenced.
383     m_current_iterator = m_connected_slots.end();
384   }
385 
386 #if !defined(NDEBUG)
connected(has_slots_interface * pclass)387   bool connected(has_slots_interface* pclass) {
388     lock_block<mt_policy> lock(this);
389     connections_list::const_iterator it = m_connected_slots.begin();
390     connections_list::const_iterator itEnd = m_connected_slots.end();
391     while (it != itEnd) {
392       if (it->getdest() == pclass)
393         return true;
394       ++it;
395     }
396     return false;
397   }
398 #endif
399 
disconnect(has_slots_interface * pclass)400   void disconnect(has_slots_interface* pclass) {
401     lock_block<mt_policy> lock(this);
402     connections_list::iterator it = m_connected_slots.begin();
403     connections_list::iterator itEnd = m_connected_slots.end();
404 
405     while (it != itEnd) {
406       if (it->getdest() == pclass) {
407         // If we're currently using this iterator because the signal is firing,
408         // advance it to avoid it being invalidated.
409         if (m_current_iterator == it) {
410           m_current_iterator = m_connected_slots.erase(it);
411         } else {
412           m_connected_slots.erase(it);
413         }
414         pclass->signal_disconnect(static_cast<_signal_base_interface*>(this));
415         return;
416       }
417       ++it;
418     }
419   }
420 
421  private:
do_slot_disconnect(_signal_base_interface * p,has_slots_interface * pslot)422   static void do_slot_disconnect(_signal_base_interface* p,
423                                  has_slots_interface* pslot) {
424     _signal_base* const self = static_cast<_signal_base*>(p);
425     lock_block<mt_policy> lock(self);
426     connections_list::iterator it = self->m_connected_slots.begin();
427     connections_list::iterator itEnd = self->m_connected_slots.end();
428 
429     while (it != itEnd) {
430       connections_list::iterator itNext = it;
431       ++itNext;
432 
433       if (it->getdest() == pslot) {
434         // If we're currently using this iterator because the signal is firing,
435         // advance it to avoid it being invalidated.
436         if (self->m_current_iterator == it) {
437           self->m_current_iterator = self->m_connected_slots.erase(it);
438         } else {
439           self->m_connected_slots.erase(it);
440         }
441       }
442 
443       it = itNext;
444     }
445   }
446 
do_slot_duplicate(_signal_base_interface * p,const has_slots_interface * oldtarget,has_slots_interface * newtarget)447   static void do_slot_duplicate(_signal_base_interface* p,
448                                 const has_slots_interface* oldtarget,
449                                 has_slots_interface* newtarget) {
450     _signal_base* const self = static_cast<_signal_base*>(p);
451     lock_block<mt_policy> lock(self);
452     connections_list::iterator it = self->m_connected_slots.begin();
453     connections_list::iterator itEnd = self->m_connected_slots.end();
454 
455     while (it != itEnd) {
456       if (it->getdest() == oldtarget) {
457         self->m_connected_slots.push_back(it->duplicate(newtarget));
458       }
459 
460       ++it;
461     }
462   }
463 
464  protected:
465   connections_list m_connected_slots;
466 
467   // Used to handle a slot being disconnected while a signal is
468   // firing (iterating m_connected_slots).
469   connections_list::iterator m_current_iterator;
470   bool m_erase_current_iterator = false;
471 };
472 
473 template <class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
474 class has_slots : public has_slots_interface, public mt_policy {
475  private:
476   typedef std::set<_signal_base_interface*> sender_set;
477   typedef sender_set::const_iterator const_iterator;
478 
479  public:
has_slots()480   has_slots()
481       : has_slots_interface(&has_slots::do_signal_connect,
482                             &has_slots::do_signal_disconnect,
483                             &has_slots::do_disconnect_all) {}
484 
has_slots(has_slots const & o)485   has_slots(has_slots const& o)
486       : has_slots_interface(&has_slots::do_signal_connect,
487                             &has_slots::do_signal_disconnect,
488                             &has_slots::do_disconnect_all) {
489     lock_block<mt_policy> lock(this);
490     for (auto* sender : o.m_senders) {
491       sender->slot_duplicate(&o, this);
492       m_senders.insert(sender);
493     }
494   }
495 
~has_slots()496   ~has_slots() { this->disconnect_all(); }
497 
498  private:
499   has_slots& operator=(has_slots const&);
500 
do_signal_connect(has_slots_interface * p,_signal_base_interface * sender)501   static void do_signal_connect(has_slots_interface* p,
502                                 _signal_base_interface* sender) {
503     has_slots* const self = static_cast<has_slots*>(p);
504     lock_block<mt_policy> lock(self);
505     self->m_senders.insert(sender);
506   }
507 
do_signal_disconnect(has_slots_interface * p,_signal_base_interface * sender)508   static void do_signal_disconnect(has_slots_interface* p,
509                                    _signal_base_interface* sender) {
510     has_slots* const self = static_cast<has_slots*>(p);
511     lock_block<mt_policy> lock(self);
512     self->m_senders.erase(sender);
513   }
514 
do_disconnect_all(has_slots_interface * p)515   static void do_disconnect_all(has_slots_interface* p) {
516     has_slots* const self = static_cast<has_slots*>(p);
517     lock_block<mt_policy> lock(self);
518     while (!self->m_senders.empty()) {
519       std::set<_signal_base_interface*> senders;
520       senders.swap(self->m_senders);
521       const_iterator it = senders.begin();
522       const_iterator itEnd = senders.end();
523 
524       while (it != itEnd) {
525         _signal_base_interface* s = *it;
526         ++it;
527         s->slot_disconnect(p);
528       }
529     }
530   }
531 
532  private:
533   sender_set m_senders;
534 };
535 
536 template <class mt_policy, typename... Args>
537 class signal_with_thread_policy : public _signal_base<mt_policy> {
538  private:
539   typedef _signal_base<mt_policy> base;
540 
541  protected:
542   typedef typename base::connections_list connections_list;
543 
544  public:
signal_with_thread_policy()545   signal_with_thread_policy() {}
546 
547   template <class desttype>
connect(desttype * pclass,void (desttype::* pmemfun)(Args...))548   void connect(desttype* pclass, void (desttype::*pmemfun)(Args...)) {
549     lock_block<mt_policy> lock(this);
550     this->m_connected_slots.push_back(_opaque_connection(pclass, pmemfun));
551     pclass->signal_connect(static_cast<_signal_base_interface*>(this));
552   }
553 
emit(Args...args)554   void emit(Args... args) {
555     lock_block<mt_policy> lock(this);
556     this->m_current_iterator = this->m_connected_slots.begin();
557     while (this->m_current_iterator != this->m_connected_slots.end()) {
558       _opaque_connection const& conn = *this->m_current_iterator;
559       ++(this->m_current_iterator);
560       conn.emit<Args...>(args...);
561     }
562   }
563 
operator()564   void operator()(Args... args) { emit(args...); }
565 };
566 
567 // Alias with default thread policy. Needed because both default arguments
568 // and variadic template arguments must go at the end of the list, so we
569 // can't have both at once.
570 template <typename... Args>
571 using signal = signal_with_thread_policy<SIGSLOT_DEFAULT_MT_POLICY, Args...>;
572 
573 // The previous verion of sigslot didn't use variadic templates, so you would
574 // need to write "sigslot::signal2<Arg1, Arg2>", for example.
575 // Now you can just write "sigslot::signal<Arg1, Arg2>", but these aliases
576 // exist for backwards compatibility.
577 template <typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
578 using signal0 = signal_with_thread_policy<mt_policy>;
579 
580 template <typename A1, typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
581 using signal1 = signal_with_thread_policy<mt_policy, A1>;
582 
583 template <typename A1,
584           typename A2,
585           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
586 using signal2 = signal_with_thread_policy<mt_policy, A1, A2>;
587 
588 template <typename A1,
589           typename A2,
590           typename A3,
591           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
592 using signal3 = signal_with_thread_policy<mt_policy, A1, A2, A3>;
593 
594 template <typename A1,
595           typename A2,
596           typename A3,
597           typename A4,
598           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
599 using signal4 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4>;
600 
601 template <typename A1,
602           typename A2,
603           typename A3,
604           typename A4,
605           typename A5,
606           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
607 using signal5 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5>;
608 
609 template <typename A1,
610           typename A2,
611           typename A3,
612           typename A4,
613           typename A5,
614           typename A6,
615           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
616 using signal6 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6>;
617 
618 template <typename A1,
619           typename A2,
620           typename A3,
621           typename A4,
622           typename A5,
623           typename A6,
624           typename A7,
625           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
626 using signal7 =
627     signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6, A7>;
628 
629 template <typename A1,
630           typename A2,
631           typename A3,
632           typename A4,
633           typename A5,
634           typename A6,
635           typename A7,
636           typename A8,
637           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
638 using signal8 =
639     signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6, A7, A8>;
640 
641 }  // namespace sigslot
642 
643 #endif /* RTC_BASE_THIRD_PARTY_SIGSLOT_SIGSLOT_H_ */
644