• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 (24 bytes for MSVC)
294   // for virtual classes, so make sure we have enough space to store it.
295 #if defined(_MSC_VER) && !defined(__clang__)
296   unsigned char pmethod[24];
297 #else
298   unsigned char pmethod[16];
299 #endif
300 
301  public:
302   template <typename DestT, typename... Args>
_opaque_connection(DestT * pd,void (DestT::* pm)(Args...))303   _opaque_connection(DestT* pd, void (DestT::*pm)(Args...)) : pdest(pd) {
304     typedef void (DestT::*pm_t)(Args...);
305     static_assert(sizeof(pm_t) <= sizeof(pmethod),
306                   "Size of slot function pointer too large.");
307 
308     std::memcpy(pmethod, &pm, sizeof(pm_t));
309 
310     typedef void (*em_t)(const _opaque_connection* self, Args...);
311     union_caster<em_t, emit_t> caster2;
312     caster2.from = &_opaque_connection::emitter<DestT, Args...>;
313     pemit = caster2.to;
314   }
315 
getdest()316   has_slots_interface* getdest() const { return pdest; }
317 
duplicate(has_slots_interface * newtarget)318   _opaque_connection duplicate(has_slots_interface* newtarget) const {
319     _opaque_connection res = *this;
320     res.pdest = newtarget;
321     return res;
322   }
323 
324   // Just calls the stored "emitter" function pointer stored at construction
325   // time.
326   template <typename... Args>
emit(Args...args)327   void emit(Args... args) const {
328     typedef void (*em_t)(const _opaque_connection*, Args...);
329     union_caster<emit_t, em_t> caster;
330     caster.from = pemit;
331     (caster.to)(this, args...);
332   }
333 
334  private:
335   template <typename DestT, typename... Args>
emitter(const _opaque_connection * self,Args...args)336   static void emitter(const _opaque_connection* self, Args... args) {
337     typedef void (DestT::*pm_t)(Args...);
338     pm_t pm;
339     static_assert(sizeof(pm_t) <= sizeof(pmethod),
340                   "Size of slot function pointer too large.");
341     std::memcpy(&pm, self->pmethod, sizeof(pm_t));
342     (static_cast<DestT*>(self->pdest)->*(pm))(args...);
343   }
344 };
345 
346 template <class mt_policy>
347 class _signal_base : public _signal_base_interface, public mt_policy {
348  protected:
349   typedef std::list<_opaque_connection> connections_list;
350 
_signal_base()351   _signal_base()
352       : _signal_base_interface(&_signal_base::do_slot_disconnect,
353                                &_signal_base::do_slot_duplicate),
354         m_current_iterator(m_connected_slots.end()) {}
355 
~_signal_base()356   ~_signal_base() { disconnect_all(); }
357 
358  private:
359   _signal_base& operator=(_signal_base const& that);
360 
361  public:
_signal_base(const _signal_base & o)362   _signal_base(const _signal_base& o)
363       : _signal_base_interface(&_signal_base::do_slot_disconnect,
364                                &_signal_base::do_slot_duplicate),
365         m_current_iterator(m_connected_slots.end()) {
366     lock_block<mt_policy> lock(this);
367     for (const auto& connection : o.m_connected_slots) {
368       connection.getdest()->signal_connect(this);
369       m_connected_slots.push_back(connection);
370     }
371   }
372 
is_empty()373   bool is_empty() {
374     lock_block<mt_policy> lock(this);
375     return m_connected_slots.empty();
376   }
377 
disconnect_all()378   void disconnect_all() {
379     lock_block<mt_policy> lock(this);
380 
381     while (!m_connected_slots.empty()) {
382       has_slots_interface* pdest = m_connected_slots.front().getdest();
383       m_connected_slots.pop_front();
384       pdest->signal_disconnect(static_cast<_signal_base_interface*>(this));
385     }
386     // If disconnect_all is called while the signal is firing, advance the
387     // current slot iterator to the end to avoid an invalidated iterator from
388     // being dereferenced.
389     m_current_iterator = m_connected_slots.end();
390   }
391 
392 #if !defined(NDEBUG)
connected(has_slots_interface * pclass)393   bool connected(has_slots_interface* pclass) {
394     lock_block<mt_policy> lock(this);
395     connections_list::const_iterator it = m_connected_slots.begin();
396     connections_list::const_iterator itEnd = m_connected_slots.end();
397     while (it != itEnd) {
398       if (it->getdest() == pclass)
399         return true;
400       ++it;
401     }
402     return false;
403   }
404 #endif
405 
disconnect(has_slots_interface * pclass)406   void disconnect(has_slots_interface* pclass) {
407     lock_block<mt_policy> lock(this);
408     connections_list::iterator it = m_connected_slots.begin();
409     connections_list::iterator itEnd = m_connected_slots.end();
410 
411     while (it != itEnd) {
412       if (it->getdest() == pclass) {
413         // If we're currently using this iterator because the signal is firing,
414         // advance it to avoid it being invalidated.
415         if (m_current_iterator == it) {
416           m_current_iterator = m_connected_slots.erase(it);
417         } else {
418           m_connected_slots.erase(it);
419         }
420         pclass->signal_disconnect(static_cast<_signal_base_interface*>(this));
421         return;
422       }
423       ++it;
424     }
425   }
426 
427  private:
do_slot_disconnect(_signal_base_interface * p,has_slots_interface * pslot)428   static void do_slot_disconnect(_signal_base_interface* p,
429                                  has_slots_interface* pslot) {
430     _signal_base* const self = static_cast<_signal_base*>(p);
431     lock_block<mt_policy> lock(self);
432     connections_list::iterator it = self->m_connected_slots.begin();
433     connections_list::iterator itEnd = self->m_connected_slots.end();
434 
435     while (it != itEnd) {
436       connections_list::iterator itNext = it;
437       ++itNext;
438 
439       if (it->getdest() == pslot) {
440         // If we're currently using this iterator because the signal is firing,
441         // advance it to avoid it being invalidated.
442         if (self->m_current_iterator == it) {
443           self->m_current_iterator = self->m_connected_slots.erase(it);
444         } else {
445           self->m_connected_slots.erase(it);
446         }
447       }
448 
449       it = itNext;
450     }
451   }
452 
do_slot_duplicate(_signal_base_interface * p,const has_slots_interface * oldtarget,has_slots_interface * newtarget)453   static void do_slot_duplicate(_signal_base_interface* p,
454                                 const has_slots_interface* oldtarget,
455                                 has_slots_interface* newtarget) {
456     _signal_base* const self = static_cast<_signal_base*>(p);
457     lock_block<mt_policy> lock(self);
458     connections_list::iterator it = self->m_connected_slots.begin();
459     connections_list::iterator itEnd = self->m_connected_slots.end();
460 
461     while (it != itEnd) {
462       if (it->getdest() == oldtarget) {
463         self->m_connected_slots.push_back(it->duplicate(newtarget));
464       }
465 
466       ++it;
467     }
468   }
469 
470  protected:
471   connections_list m_connected_slots;
472 
473   // Used to handle a slot being disconnected while a signal is
474   // firing (iterating m_connected_slots).
475   connections_list::iterator m_current_iterator;
476   bool m_erase_current_iterator = false;
477 };
478 
479 template <class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
480 class has_slots : public has_slots_interface, public mt_policy {
481  private:
482   typedef std::set<_signal_base_interface*> sender_set;
483   typedef sender_set::const_iterator const_iterator;
484 
485  public:
has_slots()486   has_slots()
487       : has_slots_interface(&has_slots::do_signal_connect,
488                             &has_slots::do_signal_disconnect,
489                             &has_slots::do_disconnect_all) {}
490 
has_slots(has_slots const & o)491   has_slots(has_slots const& o)
492       : has_slots_interface(&has_slots::do_signal_connect,
493                             &has_slots::do_signal_disconnect,
494                             &has_slots::do_disconnect_all) {
495     lock_block<mt_policy> lock(this);
496     for (auto* sender : o.m_senders) {
497       sender->slot_duplicate(&o, this);
498       m_senders.insert(sender);
499     }
500   }
501 
~has_slots()502   ~has_slots() { this->disconnect_all(); }
503 
504  private:
505   has_slots& operator=(has_slots const&);
506 
do_signal_connect(has_slots_interface * p,_signal_base_interface * sender)507   static void do_signal_connect(has_slots_interface* p,
508                                 _signal_base_interface* sender) {
509     has_slots* const self = static_cast<has_slots*>(p);
510     lock_block<mt_policy> lock(self);
511     self->m_senders.insert(sender);
512   }
513 
do_signal_disconnect(has_slots_interface * p,_signal_base_interface * sender)514   static void do_signal_disconnect(has_slots_interface* p,
515                                    _signal_base_interface* sender) {
516     has_slots* const self = static_cast<has_slots*>(p);
517     lock_block<mt_policy> lock(self);
518     self->m_senders.erase(sender);
519   }
520 
do_disconnect_all(has_slots_interface * p)521   static void do_disconnect_all(has_slots_interface* p) {
522     has_slots* const self = static_cast<has_slots*>(p);
523     lock_block<mt_policy> lock(self);
524     while (!self->m_senders.empty()) {
525       std::set<_signal_base_interface*> senders;
526       senders.swap(self->m_senders);
527       const_iterator it = senders.begin();
528       const_iterator itEnd = senders.end();
529 
530       while (it != itEnd) {
531         _signal_base_interface* s = *it;
532         ++it;
533         s->slot_disconnect(p);
534       }
535     }
536   }
537 
538  private:
539   sender_set m_senders;
540 };
541 
542 template <class mt_policy, typename... Args>
543 class signal_with_thread_policy : public _signal_base<mt_policy> {
544  private:
545   typedef _signal_base<mt_policy> base;
546 
547  protected:
548   typedef typename base::connections_list connections_list;
549 
550  public:
signal_with_thread_policy()551   signal_with_thread_policy() {}
552 
553   template <class desttype>
connect(desttype * pclass,void (desttype::* pmemfun)(Args...))554   void connect(desttype* pclass, void (desttype::*pmemfun)(Args...)) {
555     lock_block<mt_policy> lock(this);
556     this->m_connected_slots.push_back(_opaque_connection(pclass, pmemfun));
557     pclass->signal_connect(static_cast<_signal_base_interface*>(this));
558   }
559 
emit(Args...args)560   void emit(Args... args) {
561     lock_block<mt_policy> lock(this);
562     this->m_current_iterator = this->m_connected_slots.begin();
563     while (this->m_current_iterator != this->m_connected_slots.end()) {
564       _opaque_connection const& conn = *this->m_current_iterator;
565       ++(this->m_current_iterator);
566       conn.emit<Args...>(args...);
567     }
568   }
569 
operator()570   void operator()(Args... args) { emit(args...); }
571 };
572 
573 // Alias with default thread policy. Needed because both default arguments
574 // and variadic template arguments must go at the end of the list, so we
575 // can't have both at once.
576 template <typename... Args>
577 using signal = signal_with_thread_policy<SIGSLOT_DEFAULT_MT_POLICY, Args...>;
578 
579 // The previous verion of sigslot didn't use variadic templates, so you would
580 // need to write "sigslot::signal2<Arg1, Arg2>", for example.
581 // Now you can just write "sigslot::signal<Arg1, Arg2>", but these aliases
582 // exist for backwards compatibility.
583 template <typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
584 using signal0 = signal_with_thread_policy<mt_policy>;
585 
586 template <typename A1, typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
587 using signal1 = signal_with_thread_policy<mt_policy, A1>;
588 
589 template <typename A1,
590           typename A2,
591           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
592 using signal2 = signal_with_thread_policy<mt_policy, A1, A2>;
593 
594 template <typename A1,
595           typename A2,
596           typename A3,
597           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
598 using signal3 = signal_with_thread_policy<mt_policy, A1, A2, A3>;
599 
600 template <typename A1,
601           typename A2,
602           typename A3,
603           typename A4,
604           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
605 using signal4 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4>;
606 
607 template <typename A1,
608           typename A2,
609           typename A3,
610           typename A4,
611           typename A5,
612           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
613 using signal5 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5>;
614 
615 template <typename A1,
616           typename A2,
617           typename A3,
618           typename A4,
619           typename A5,
620           typename A6,
621           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
622 using signal6 = signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6>;
623 
624 template <typename A1,
625           typename A2,
626           typename A3,
627           typename A4,
628           typename A5,
629           typename A6,
630           typename A7,
631           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
632 using signal7 =
633     signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6, A7>;
634 
635 template <typename A1,
636           typename A2,
637           typename A3,
638           typename A4,
639           typename A5,
640           typename A6,
641           typename A7,
642           typename A8,
643           typename mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
644 using signal8 =
645     signal_with_thread_policy<mt_policy, A1, A2, A3, A4, A5, A6, A7, A8>;
646 
647 }  // namespace sigslot
648 
649 #endif /* RTC_BASE_THIRD_PARTY_SIGSLOT_SIGSLOT_H_ */
650