Update README.md
[nemesis.git] / Platform / Event.cpp
1 /*
2  Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved.
3
4  Governed by the TrueCrypt License 3.0 the full text of which is contained in
5  the file License.txt included in TrueCrypt binary and source code distribution
6  packages.
7 */
8
9 #include "Event.h"
10
11 namespace TrueCrypt
12 {
13         void Event::Connect (const EventConnectorBase &connector)
14         {
15                 ScopeLock lock (HandlersMutex);
16                 ConnectedHandlers.push_back (shared_ptr <EventConnectorBase> (connector.CloneNew()));
17         }
18         
19         void Event::Disconnect (void *handler)
20         {
21                 ScopeLock lock (HandlersMutex);
22
23                 EventHandlerList newConnectedHandlers;
24                 foreach (shared_ptr <EventConnectorBase> h, ConnectedHandlers)
25                 {
26                         if (h->GetHandler() != handler)
27                                 newConnectedHandlers.push_back (h);
28                 }
29
30                 ConnectedHandlers = newConnectedHandlers;
31         }
32
33         void Event::Raise ()
34         {
35                 EventArgs args;
36                 Raise (args);
37         }
38
39         void Event::Raise (EventArgs &args)
40         {
41                 ScopeLock lock (HandlersMutex);
42                 foreach_ref (EventConnectorBase &handler, ConnectedHandlers)
43                 {
44                         handler (args);
45                 }
46         }
47 }
This page took 0.015624 seconds and 3 git commands to generate. Download a nemesis OSX (sierra+high sierra, tested/working) binary, with fuse-ext3 via e2fsprogs, at this link. application and installer are signed by screwjack, llc. must install fuse with macFUSE layer first.