Ejemplo n.º 1
0
        internal void Update(NativeQueue <IPCQueuedMessage> queue)
        {
            IPCQueuedMessage val;

            while (queue.TryDequeue(out val))
            {
                m_IPCQueue.Enqueue(val.dest, val.data);
            }
        }
Ejemplo n.º 2
0
        public void NativeMultiQueue_SimpleScenarios()
        {
            using (NativeMultiQueue <int> eventQ = new NativeMultiQueue <int>(5))
            {
                for (int connection = 0; connection < 5; connection++)
                {
                    // Test Add
                    int item = 0;

                    eventQ.Enqueue(connection, 1);
                    eventQ.Enqueue(connection, 1);
                    eventQ.Enqueue(connection, 1);
                    eventQ.Enqueue(connection, 1);
                    eventQ.Enqueue(connection, 1);

                    // Add grows capacity
                    eventQ.Enqueue(connection, 1);

                    // Test Rem
                    Assert.True(eventQ.Dequeue(connection, out item));
                    Assert.True(eventQ.Dequeue(connection, out item));
                    Assert.True(eventQ.Dequeue(connection, out item));
                    Assert.True(eventQ.Dequeue(connection, out item));
                    Assert.True(eventQ.Dequeue(connection, out item));

                    // Remove with grown capacity
                    Assert.True(eventQ.Dequeue(connection, out item));
                }
            }
        }
Ejemplo n.º 3
0
        internal unsafe void Update(NetworkInterfaceEndPoint local, NativeQueue <QueuedSendMessage> queue)
        {
            QueuedSendMessage val;

            while (queue.TryDequeue(out val))
            {
                var ipcData = new IPCData();
                UnsafeUtility.MemCpy(ipcData.data, val.Data, val.DataLength);
                ipcData.length = val.DataLength;
                ipcData.from   = *(int *)local.data;
                m_IPCQueue.Enqueue(*(int *)val.Dest.data, ipcData);
            }
        }