Annotation of truecrypt/platform/event.cpp, revision 1.1.1.3

1.1.1.2   root        1: /*
                      2:  Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
                      3: 
1.1.1.3 ! root        4:  Governed by the TrueCrypt License 2.6 the full text of which is contained
1.1.1.2   root        5:  in the file License.txt included in TrueCrypt binary and source code
                      6:  distribution packages.
                      7: */
                      8: 
1.1       root        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: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.