示例#1
0
        protected TestInstance()
        {
            _fiber = new SynchronousFiber();

            UpdateValueChannel = new ConsumerChannel<UpdateValue>(_fiber, HandleUpdateValue);
            PreviousValues = new List<PreviousValue>();
        }
示例#2
0
        public Auction(Fiber fiber, Inbox inbox, Guid id)
        {
            Id = id;
            _inbox = inbox;
            _fiber = fiber;

            AskChannel = new SelectiveConsumerChannel<Request<Ask>>(_fiber, HandleAsk);
            EndChannel = new ConsumerChannel<End>(_fiber, x => { _ended = true; });
        }
        /// <summary>
        /// Creates a PollingFileSystemEventProducer
        /// </summary>		
        /// <param name="directory">The directory to watch</param>
        /// <param name="channel">The channel where events should be sent</param>
        /// <param name="scheduler">Event scheduler</param>
        /// <param name="fiber">Fiber to schedule on</param>
        /// <param name="checkInterval">The maximal time between events or polls on a given file</param>
        /// <param name="checkSubDirectory">Indicates if subdirectorys will be checked or ignored</param>
        public PollingFileSystemEventProducer(string directory, UntypedChannel channel, Scheduler scheduler, Fiber fiber,
            TimeSpan checkInterval, bool checkSubDirectory)
        {
            _directory = directory;
            _channel = channel;
            _fiber = fiber;
            _hashes = new Dictionary<string, Guid>();
            _scheduler = scheduler;
            _checkInterval = checkInterval;

            _scheduledAction = scheduler.Schedule(3.Seconds(), _fiber, HashFileSystem);

            ChannelAdapter myChannel = new ChannelAdapter();

            _connection = myChannel.Connect(connectionConfigurator =>
            {
                connectionConfigurator.AddConsumerOf<FileSystemChanged>().UsingConsumer(HandleFileSystemChangedAndCreated);
                connectionConfigurator.AddConsumerOf<FileSystemCreated>().UsingConsumer(HandleFileSystemChangedAndCreated);
                connectionConfigurator.AddConsumerOf<FileSystemRenamed>().UsingConsumer(HandleFileSystemRenamed);
                connectionConfigurator.AddConsumerOf<FileSystemDeleted>().UsingConsumer(HandleFileSystemDeleted);
            });

            _fileSystemEventProducer = new FileSystemEventProducer(directory, myChannel, checkSubDirectory);
        }
 /// <summary>
 /// Creates a PollingFileSystemEventProducer
 /// </summary>		
 /// <param name="directory">The directory to watch</param>
 /// <param name="channel">The channel where events should be sent</param>
 /// <param name="scheduler">Event scheduler</param>
 /// <param name="fiber">Fiber to schedule on</param>
 /// <param name="checkInterval">The maximal time between events or polls on a given file</param>
 public PollingFileSystemEventProducer(string directory, UntypedChannel channel, Scheduler scheduler, Fiber fiber,
     TimeSpan checkInterval)
     : this(directory, channel, scheduler, fiber, checkInterval, true)
 {
 }
示例#5
0
 public PongActor()
 {
     _fiber = new ThreadPoolFiber();
 }
示例#6
0
 AnonymousActor(Fiber fiber, Scheduler scheduler, Inbox inbox)
 {
     _fiber = fiber;
     _scheduler = scheduler;
     _inbox = inbox;
 }
示例#7
0
            public MyConsumer(Fiber fiber)
            {
                _fiber = fiber;

                Called = new Future<MyCommand>();
                CommandChannel = new ConsumerChannel<MyCommand>(_fiber, HandleMyCommand);
            }
 public static void Main()
 {
     for (int i = 0; i < 7; i++)
     {
         Process process = new Process();
         Fiber fiber = new Fiber(new Action(process.Run));
         fibers.Add(fiber.Id);
     }
     Switch(false);
 }