Ejemplo n.º 1
0
 /// <summary>
 /// Constructor that gets the finder of methods marked with specific atrributes.
 /// </summary>
 /// <param name="finder"></param>
 public EventBus(IHandlerFindingStrategy finder)
 {
     //TODO : readerwriterlockslim , conccurentdictionary.
     //Replace with ninject tools.
     this.finder = finder;
     handlersByType = HashMultiMap<Type, EventHandler>.Create();
     handlersByTypeLock = new ReaderWriterLockSlim();
     eventsToDispatch = new ThreadLocal<Queue<EventWithHandler>>(() => { return new Queue<EventWithHandler>(); });
     isDispatching = new ThreadLocal<Boolean>(() => { return false; });                                        
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor that gets the finder of methods marked with specific atrributes.
        /// </summary>
        /// <param name="finder"></param>
        public EventBus(IHandlerFindingStrategy finder)
        {
            //TODO : readerwriterlockslim , conccurentdictionary.
            //Replace with ninject tools.
            this.finder    = finder;
            handlersByType = HashMultiMap <Type, EventHandler> .Create();

            handlersByTypeLock = new ReaderWriterLockSlim();
            eventsToDispatch   = new ThreadLocal <Queue <EventWithHandler> >(() => { return(new Queue <EventWithHandler>()); });
            isDispatching      = new ThreadLocal <Boolean>(() => { return(false); });
        }