| OLD | NEW |
| (Empty) |
| 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 WEBRTC_BASE_SIGSLOT_H_ | |
| 97 #define WEBRTC_BASE_SIGSLOT_H_ | |
| 98 | |
| 99 | |
| 100 // This header is deprecated and is just left here temporarily during | |
| 101 // refactoring. See https://bugs.webrtc.org/7634 for more details. | |
| 102 #include "webrtc/rtc_base/sigslot.h" | |
| 103 | |
| 104 #endif // WEBRTC_BASE_SIGSLOT_H_ | |
| OLD | NEW |