Пример #1
0
        private static void RunPhysicalCompletions(object state)
        {
            var thread = ((RioThread)state);

#if NET451
            Thread.BeginThreadAffinity();
#endif
            var nativeThread = GetCurrentThread();
            var affinity     = GetAffinity(thread._id);
            nativeThread.ProcessorAffinity = new IntPtr((long)affinity);

            thread._connections      = new Dictionary <long, RioTcpConnection>();
            thread._bufferIdMappings = new List <BufferMapping>();

            var memoryPool = new MemoryPool();
            memoryPool.RegisterSlabAllocationCallback((slab) => thread.OnSlabAllocated(slab));
            memoryPool.RegisterSlabDeallocationCallback((slab) => thread.OnSlabDeallocated(slab));
            thread._factory = new PipeFactory(memoryPool);

            thread.ProcessPhysicalCompletions();

#if NET451
            Thread.EndThreadAffinity();
#endif
        }
Пример #2
0
 public RioThread(int id, CancellationToken token, IntPtr completionPort, IntPtr completionQueue, RegisteredIO rio)
 {
     _id         = id;
     _rio        = rio;
     _token      = token;
     _memoryPool = new MemoryPool();
     _memoryPool.RegisterSlabAllocationCallback(OnSlabAllocated);
     _memoryPool.RegisterSlabDeallocationCallback(OnSlabDeallocated);
     _channelFactory      = new ChannelFactory(_memoryPool);
     _connections         = new ConcurrentDictionary <long, RioTcpConnection>();
     _thread              = new Thread(OnThreadStart);
     _thread.Name         = "RIOThread " + id;
     _thread.IsBackground = true;
     _completionPort      = completionPort;
     _completionQueue     = completionQueue;
 }
Пример #3
0
        private static void RunPhysicalCompletions(object state)
        {

            var thread = ((RioThread)state);
#if NET451
            Thread.BeginThreadAffinity();
#endif
            var nativeThread = GetCurrentThread();
            var affinity = GetAffinity(thread._id);
            nativeThread.ProcessorAffinity = new IntPtr((long)affinity);

            thread._connections = new Dictionary<long, RioTcpConnection>();
            thread._bufferIdMappings = new List<BufferMapping>();

            var memoryPool = new MemoryPool();
            memoryPool.RegisterSlabAllocationCallback((slab) => thread.OnSlabAllocated(slab));
            memoryPool.RegisterSlabDeallocationCallback((slab) => thread.OnSlabDeallocated(slab));
            thread._factory = new PipelineFactory(memoryPool);

            thread.ProcessPhysicalCompletions();

#if NET451
            Thread.EndThreadAffinity();
#endif
        }