public List <MiningMaterial> MiningMaterials()
        {
            List <MiningMaterial> materials = new List <MiningMaterial>();

            using (m_lock.AcquireSharedUsing())
            {
                for (int i = 0; i < 256; i++)
                {
                    if (m_materials[i].Count == 0)
                    {
                        continue;
                    }

                    var voxelDefinition = MyDefinitionManager.Static.GetVoxelMaterialDefinition((byte)i);
                    if (voxelDefinition == null)
                    {
                        continue;
                    }

                    materials.Add(new MiningMaterial()
                    {
                        EntityId      = m_voxelMap.EntityId,
                        VoxelPosition = m_materials[i].VoxelPosition,
                        WorldPosition = m_materials[i].WorldPosition,
                        Count         = m_materials[i].Count,
                        Material      = (byte)i,
                        Definition    = voxelDefinition,
                    });
                }
            }

            return(materials);
        }
Пример #2
0
 public static MyStringHash Get(string str)
 {
     using (m_lock.AcquireSharedUsing())
     {
         return(m_stringToHash[str]);
     }
 }
Пример #3
0
        private static void GetDetectedObjects()
        {
            using (MyEntities.EntityCloseLock.AcquireSharedUsing())
            {
                using (m_detectedObjectsLock.AcquireSharedUsing())
                {
                    Debug.Assert(m_detectedObjectsHelperCollection.Count == 0);
                    foreach (IMyObjectToDetect obj in m_objectsToDetect)
                    {
                        // if we are in radar jammer's range or in sun wind jam range, then we detect only friends
                        if (IsNearRadarJammerOrSunWind() && obj is MyEntity && (MyFactions.GetFactionsRelation(GetOwner().Faction, ((MyEntity)obj).Faction) == MyFactionRelationEnum.Enemy))
                        {
                            continue;
                        }

                        //activeDetector.IsDetected(GetRadarPosition(), objectToDetect)
                        if (!CanBeDetected(obj))
                        {
                            continue;
                        }

                        BoundingSphere detectingSphere = new BoundingSphere(GetOwner().GetPosition(), DefaultRadarRange);
                        if (!detectingSphere.Intersects(obj.WorldAABB))
                        {
                            continue;
                        }

                        m_detectedObjectsHelperCollection.Add(obj);
                    }
                    m_objectsToDetect.Clear();
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Perform an action on each LastSeen. Invalid LastSeen are removed by this method.
        /// </summary>
        /// <param name="method">Action invoked on each LastSeen.</param>
        public void ForEachLastSeen(Action <LastSeen> method)
        {
            List <LastSeen> invalid = null;

            using (lock_lastSeen.AcquireSharedUsing())
                foreach (LastSeen seen in m_lastSeen.Values)
                {
                    if (seen.IsValid)
                    {
                        method(seen);
                    }
                    else
                    {
                        if (invalid == null)
                        {
                            invalid = new List <LastSeen>();
                        }
                        invalid.Add(seen);
                    }
                }

            if (invalid != null)
            {
                Log.DebugLog("Removing " + invalid.Count + " invalid LastSeen", Logger.severity.DEBUG);
                using (lock_lastSeen.AcquireExclusiveUsing())
                    foreach (LastSeen seen in invalid)
                    {
                        m_lastSeen.Remove(seen.Entity.EntityId);
                    }
            }

            m_nextClean_lastSeen = Globals.UpdateCount + s_cleanInterval;
        }
Пример #5
0
        private MyStat GetStat(string name)
        {
            MyStat result;

            using (m_lock.AcquireSharedUsing())
            {
                if (m_stats.TryGetValue(name, out result))
                {
                    return(result);
                }
            }
            using (m_lock.AcquireExclusiveUsing())
            {
                // Racing condition, someone can faster insert this value
                if (m_stats.TryGetValue(name, out result))
                {
                    return(result);
                }
                else
                {
                    result        = new MyStat();
                    m_stats[name] = result;
                    return(result);
                }
            }
        }
Пример #6
0
 public static void GetBlocks(HashSet <MySlimBlock> entities)
 {
     using (_blockLock.AcquireSharedUsing())
     {
         entities.UnionWith(_blockCache);
     }
 }
        // ------------------------------------------------------------------------

        // Update animation state (position and orientation of bones).
        // Called from MySessionComponentAnimationSystem.
        public void Update()
        {
            using (m_componentValidLock.AcquireSharedUsing())
            {
                if (!m_componentValid)
                {
                    return;
                }
                VRage.Animations.MyAnimationUpdateData updateData = new Animations.MyAnimationUpdateData();
                updateData.DeltaTimeInSeconds = VRage.Game.MyEngineConstants.UPDATE_STEP_SIZE_IN_SECONDS;
                updateData.CharacterBones     = m_characterBones;
                updateData.Controller         = null; // will be set inside m_controller.Update automatically if null
                updateData.BonesResult        = null; // will be set inside m_controller.Update (result!)

                m_controller.Update(ref updateData);
                if (updateData.BonesResult != null)
                {
                    for (int i = 0; i < updateData.BonesResult.Count; i++)
                    {
                        CharacterBones[i].SetCompleteTransform(ref updateData.BonesResult[i].Translation,
                                                               ref updateData.BonesResult[i].Rotation);
                    }
                }
                m_lastBoneResult = updateData.BonesResult;
            }
        }
Пример #8
0
 public static bool TryGetEntityById(long entityId, out MyEntity entity)
 {
     using (_entityLock.AcquireSharedUsing())
     {
         entity = _entityCache.FirstOrDefault(e => e.EntityId == entityId);
         return(entity != null);
     }
 }
Пример #9
0
 public static bool TryGetGridById(long entityId, out MyCubeGrid entity)
 {
     using (_gridLock.AcquireSharedUsing())
     {
         entity = _gridCache.FirstOrDefault(e => e.EntityId == entityId);
         return(entity != null);
     }
 }
Пример #10
0
 public static SyncByReference CreateSyncByReference(ulong typeID, SyncComponent component, SyncDirection direction, ulong id)
 {
     using (Lock.AcquireSharedUsing())
     {
         var info = ActivatorsByID[typeID];
         return(info.Activator.Invoke(info, component, direction, id));
     }
 }
Пример #11
0
        public void ReadRange(MyStorageData target, MyStorageDataTypeFlags dataToRead, int lodIndex, ref Vector3I lodVoxelRangeMin, ref Vector3I lodVoxelRangeMax, ref MyVoxelRequestFlags requestFlags)
        {
            ProfilerShort.Begin(GetType().Name + ".ReadRange");
            try
            {
                const int SUBRANGE_SIZE_SHIFT = 3;
                const int SUBRANGE_SIZE       = 1 << SUBRANGE_SIZE_SHIFT;
                var       threshold           = new Vector3I(SUBRANGE_SIZE);
                var       rangeSize           = lodVoxelRangeMax - lodVoxelRangeMin + 1;
                if ((dataToRead & MyStorageDataTypeFlags.Content) != 0)
                {
                    target.ClearContent(0);
                }

                if ((rangeSize.X <= threshold.X &&
                     rangeSize.Y <= threshold.Y &&
                     rangeSize.Z <= threshold.Z) || !MyFakes.ENABLE_SPLIT_VOXEL_READ_QUERIES)
                {
                    using (m_lock.AcquireSharedUsing())
                    {
                        ReadRangeInternal(target, ref Vector3I.Zero, dataToRead, lodIndex, ref lodVoxelRangeMin, ref lodVoxelRangeMax, ref requestFlags);
                    }
                }
                else
                {
                    // These optimizations don't work when splitting the range.
                    requestFlags &= ~(MyVoxelRequestFlags.OneMaterial | MyVoxelRequestFlags.ContentChecked);
                    MyVoxelRequestFlags flags = requestFlags;

                    // splitting to smaller ranges to make sure the lock is not held for too long, preventing write on update thread
                    // subranges could be aligned to multiple of their size for possibly better performance
                    var steps = (rangeSize - 1) >> SUBRANGE_SIZE_SHIFT;
                    for (var it = new Vector3I.RangeIterator(ref Vector3I.Zero, ref steps); it.IsValid(); it.MoveNext())
                    {
                        flags = requestFlags;
                        var offset = it.Current << SUBRANGE_SIZE_SHIFT;
                        var min    = lodVoxelRangeMin + offset;
                        var max    = min + SUBRANGE_SIZE - 1;
                        Vector3I.Min(ref max, ref lodVoxelRangeMax, out max);
                        Debug.Assert(min.IsInsideInclusive(ref lodVoxelRangeMin, ref lodVoxelRangeMax));
                        Debug.Assert(max.IsInsideInclusive(ref lodVoxelRangeMin, ref lodVoxelRangeMax));
                        using (m_lock.AcquireSharedUsing())
                        {
                            ReadRangeInternal(target, ref offset, dataToRead, lodIndex, ref min, ref max, ref flags);
                        }
                    }

                    // If the storage is consistent this should be fine.
                    requestFlags = flags;
                }
            }
            finally
            {
                ProfilerShort.End();
            }
        }
Пример #12
0
 /// <summary>
 /// Get the fat BoundingBox for a proxy.
 /// </summary>
 /// <param name="proxyId">The proxy id.</param>
 /// <param name="fatAABB">The fat BoundingBox.</param>
 public void GetFatAABB(int proxyId, out BoundingBox fatAABB)
 {
     MyPerformanceCounter.PerCameraDraw.StartTimer("DAABB");
     using (m_rwLock.AcquireSharedUsing())
     {
         MyCommonDebugUtils.AssertDebug(0 <= proxyId && proxyId < _nodeCapacity);
         fatAABB = _nodes[proxyId].Aabb;
     }
     MyPerformanceCounter.PerCameraDraw.StopTimer("DAABB");
 }
 public void UpdateRenderInstanceData()
 {
     using (m_instancePartsLock.AcquireSharedUsing())
     {
         foreach (var part in m_instanceParts)
         {
             part.Value.UpdateRenderInstanceData();
         }
     }
 }
Пример #14
0
 public T this[int index] {
     get {
         using (lock_Queue.AcquireSharedUsing())
             return(Queue[index]);
     }
     set {
         using (lock_Queue.AcquireExclusiveUsing())
             Queue[index] = value;
     }
 }
 public void EnsureGenerationStarted()
 {
     TimeRemoved = null;
     using (m_creationQueueSemaphore.AcquireSharedUsing())
         if (m_creationQueued)
         {
             return;
         }
     using (m_creationQueueSemaphore.AcquireExclusiveUsing())
     {
         if (m_creationQueued)
         {
             return;
         }
         m_creationQueued = true;
     }
     if (IsMarkedForRemoval)
     {
         return;
     }
     if (m_construction == null)
     {
         MyAPIGateway.Parallel.StartBackground(ParallelUtilities.WrapAction(() =>
         {
             if (!Stage_Generate())
             {
                 return;
             }
             if (!Stage_Build())
             {
                 return;
             }
             MyAPIGateway.Utilities.InvokeOnGameThread(ParallelUtilities.WrapAction(Stage_SpawnGrid, Module));
         }, Module));
     }
     else if (m_grids == null)
     {
         MyAPIGateway.Parallel.StartBackground(ParallelUtilities.WrapAction(() =>
         {
             if (!Stage_Build())
             {
                 return;
             }
             MyAPIGateway.Utilities.InvokeOnGameThread(ParallelUtilities.WrapAction(Stage_SpawnGrid, Module));
         }, Module));
     }
     else if (m_component == null)
     {
         MyAPIGateway.Utilities.InvokeOnGameThread(ParallelUtilities.WrapAction(Stage_SpawnGrid, Module));
     }
     else
     {
         m_creationQueued = false;
     }
 }
Пример #16
0
 /// <summary>
 /// Registers the arbitrary handler with SE for all domains that were
 /// registered with MessageManager before we init'd.
 /// See the note in AddHandler.
 /// </summary>
 private void RegisterForDelayedDomains()
 {
     using (Lock.AcquireSharedUsing()) {
         foreach (var domainId in Handlers.Keys)
         {
             MyAPIGateway.Multiplayer.RegisterMessageHandler(
                 domainId, TryHandleMessage
                 );
         }
     }
 }
Пример #17
0
        public static int GetWeaponsTargeting(IMyEntity entity)
        {
            WeaponCounts result;

            using (lock_WeaponsTargeting.AcquireSharedUsing())
                if (!WeaponsTargeting.TryGetValue(entity.EntityId, out result))
                {
                    return(0);
                }
            return(result.Value);
        }
Пример #18
0
        public void ReadRange(MyStorageDataCache target, MyStorageDataTypeFlags dataToRead, int lodIndex, ref Vector3I lodVoxelRangeMin, ref Vector3I lodVoxelRangeMax)
        {
            ProfilerShort.Begin(GetType().Name + ".ReadRange");
            try
            {
                const int SUBRANGE_SIZE_SHIFT = 3;
                const int SUBRANGE_SIZE       = 1 << SUBRANGE_SIZE_SHIFT;
                var       threshold           = new Vector3I(SUBRANGE_SIZE);
                var       rangeSize           = lodVoxelRangeMax - lodVoxelRangeMin + 1;
                if ((dataToRead & MyStorageDataTypeFlags.Content) != 0)
                {
                    target.ClearContent(0);
                }
                if ((dataToRead & MyStorageDataTypeFlags.Material) != 0)
                {
                    target.ClearMaterials(m_defaultMaterial);
                }

                if (rangeSize.X <= threshold.X &&
                    rangeSize.Y <= threshold.Y &&
                    rangeSize.Z <= threshold.Z)
                {
                    using (m_lock.AcquireSharedUsing())
                    {
                        ReadRangeInternal(target, ref Vector3I.Zero, dataToRead, lodIndex, ref lodVoxelRangeMin, ref lodVoxelRangeMax);
                    }
                }
                else
                {
                    // splitting to smaller ranges to make sure the lock is not held for too long, preventing write on update thread
                    // subranges could be aligned to multiple of their size for possibly better performance
                    var steps = (rangeSize - 1) >> SUBRANGE_SIZE_SHIFT;
                    for (var it = new Vector3I.RangeIterator(ref Vector3I.Zero, ref steps); it.IsValid(); it.MoveNext())
                    {
                        var offset = it.Current << SUBRANGE_SIZE_SHIFT;
                        var min    = lodVoxelRangeMin + offset;
                        var max    = min + SUBRANGE_SIZE - 1;
                        Vector3I.Min(ref max, ref lodVoxelRangeMax, out max);
                        Debug.Assert(min.IsInsideInclusive(ref lodVoxelRangeMin, ref lodVoxelRangeMax));
                        Debug.Assert(max.IsInsideInclusive(ref lodVoxelRangeMin, ref lodVoxelRangeMax));
                        using (m_lock.AcquireSharedUsing())
                        {
                            ReadRangeInternal(target, ref offset, dataToRead, lodIndex, ref min, ref max);
                        }
                    }
                }
            }
            finally
            {
                ProfilerShort.End();
            }
        }
Пример #19
0
        public override void OnAddedToScene()
        {
            base.OnAddedToScene();

            using (Lock.AcquireSharedUsing())
                using (PoolManager.Get(out List <TRtKey> children))
                    using (PoolManager.Get(out HashSet <TRtKey> explored))
                    {
                        foreach (var id in Modifiers.Keys)
                        {
                            children.Add(id);
                        }

                        while (children.Count > 0)
                        {
                            var id = children[children.Count - 1];
                            children.RemoveAt(children.Count - 1);
                            if (!explored.Add(id))
                            {
                                continue;
                            }
                            GetChildren(id, children);
                            ApplyModifiers(id);
                        }
                    }
        }
        public override void UpdateAfterSimulation()
        {
            base.UpdateAfterSimulation();

            using (m_dictionaryLock.AcquireSharedUsing())
            {
                foreach (var triggerSet in m_triggers.Values)
                {
                    triggerSet.ApplyChanges();
                    foreach (var trigger in triggerSet)
                    {
                        trigger.Update();
                    }
                }
            }
        }
Пример #21
0
        /// <summary>
        /// <para>Internal receive method. Adds the Message to this storage.</para>
        /// <para>lock_m_messages should be exclusively locked before invoking this method.</para>
        /// </summary>
        private void in_Receive(Message msg)
        {
            Action <Message> handler;
            bool             gotHandler;

            Log.DebugLog("looking for a handler for " + msg.DestCubeBlock.EntityId);
            using (lock_messageHandlers.AcquireSharedUsing())
                gotHandler = m_messageHandlers.TryGetValue(msg.DestCubeBlock.EntityId, out handler);

            if (gotHandler)
            {
                Log.DebugLog("have a handler for msg");
                msg.IsValid = false;
                handler(msg);
                return;
            }

            if (m_messages.Count >= 100)
            {
                Log.AlwaysLog("Cannot receive more messages, at limit: " + m_messages.Count, Logger.severity.INFO);
                return;
            }

            if (m_messages.Add(msg))
            {
                Log.DebugLog("got a new message: " + msg.Content + ", count is now " + m_messages.Count, Logger.severity.DEBUG);
            }
            else
            {
                Log.DebugLog("already have message: " + msg.Content + ", count is now " + m_messages.Count, Logger.severity.DEBUG);
            }
        }
Пример #22
0
        /// <summary>
        /// Perform an action on each Message. Invalid Message are removed by this method.
        /// </summary>
        /// <param name="method">Action to invoke on each message.</param>
        private void ForEachMessage(Action <Message> method)
        {
            List <Message> invalid = null;

            using (lock_messages.AcquireSharedUsing())
                foreach (Message msg in m_messages)
                {
                    if (msg.IsValid)
                    {
                        method(msg);
                    }
                    else
                    {
                        if (invalid == null)
                        {
                            invalid = new List <Message>();
                        }
                        invalid.Add(msg);
                    }
                }

            if (invalid != null)
            {
                Log.DebugLog("Removing " + invalid.Count + " invalid Message", Logger.severity.DEBUG);
                using (lock_messages.AcquireExclusiveUsing())
                    foreach (Message msg in invalid)
                    {
                        m_messages.Remove(msg);
                    }
            }

            m_nextClean_message = Globals.UpdateCount + s_cleanInterval;
        }
Пример #23
0
        public void RefillPools()
        {
            if (m_missing == 0)
            {
                return;
            }
            if (m_dequeuedThisFrame && !MyFakes.CLONE_SHAPES_ON_WORKER)
            {
                m_dequeuedThisFrame = false;
                return;
            }
            ProfilerShort.Begin("Clone");
            int clonedThisFrame = 0;

            if (MyFakes.CLONE_SHAPES_ON_WORKER)
            {
                StartJobs();
            }
            else
            {
                using (m_poolLock.AcquireSharedUsing())
                {
                    foreach (var pool in m_pools)
                    {
                        foreach (var model in pool.Value)
                        {
                            if (pool.Value.Count < PREALLOCATE_COUNT)
                            {
                                MyCubeBlockDefinition def;
                                MyDefinitionManager.Static.TryGetDefinition <MyCubeBlockDefinition>(pool.Key, out def);
                                int cloneCount = Math.Min(PREALLOCATE_COUNT - pool.Value.Count, MAX_CLONE_PER_FRAME - clonedThisFrame);
                                AllocateForDefinition(model.Key, def, cloneCount);
                                clonedThisFrame += cloneCount;
                            }
                            if (clonedThisFrame >= MAX_CLONE_PER_FRAME)
                            {
                                break;
                            }
                        }
                    }
                }
            }

            m_missing -= clonedThisFrame;
            ProfilerShort.End(clonedThisFrame);
            clonedThisFrame = 0;
        }
Пример #24
0
        public IMyVoxelBase GetVoxelContainingPoint(Vector3D world, float radius = 0.866f)
        {
            var sphere = new BoundingSphereD(world, radius);

            using (m_voxelCacheStaticLock.AcquireSharedUsing())
            {
                foreach (var voxelmap in m_voxelCacheStatic)
                {
                    //Logger.Instance.LogMessage(string.Format("Scanning voxel {0} for point: {1}", voxelmap.GetType(), world));
                    if (IsInsideVoxel(voxelmap, world, radius))
                    {
                        return(voxelmap);
                    }
                }
            }
            return(null);
        }
Пример #25
0
        private float CalcForceInDirection(Base6Directions.Direction direction)
        {
            float force = 0;

            using (lock_thrustersInDirection.AcquireSharedUsing())
                foreach (MyThrust thruster in m_thrustersInDirection[(int)direction])
                {
                    if (!thruster.Closed && thruster.IsWorking)
                    {
                        force += GetThrusterMaxForce(thruster);
                    }
                }

            m_totalThrustForce[(int)direction] = force;

            if (direction == m_primaryForce.Direction)
            {
                //Log.DebugLog("updating primary force, direction: " + direction + ", force: " + force, "CalcForceInDirection()");
                m_primaryForce.Force = force;
            }
            else if (force > m_primaryForce.Force * 1.1f)
            {
                Log.DebugLog("stronger than primary force, direction: " + direction + ", force: " + force + ", acceleration: " + force / myGrid.Physics.Mass + ", primary: " + m_primaryForce, Logger.severity.DEBUG);
                m_secondaryForce         = m_primaryForce;
                m_primaryForce.Direction = direction;
                m_primaryForce.Force     = force;

                if (m_secondaryForce.Direction == Base6Directions.GetFlippedDirection(m_primaryForce.Direction))
                {
                    m_secondaryForce = new ForceInDirection()
                    {
                        Direction = Base6Directions.GetPerpendicular(m_primaryForce.Direction)
                    }
                }
                ;

                Log.DebugLog("secondary: " + m_secondaryForce);

                Standard.SetMatrixOrientation(m_primaryForce.Direction, m_secondaryForce.Direction);
                Gravity.SetMatrixOrientation(m_secondaryForce.Direction, m_primaryForce.Direction);
            }
            else if (direction == m_secondaryForce.Direction)
            {
                //Log.DebugLog("updating secondary force, direction: " + direction + ", force: " + force, "CalcForceInDirection()");
                m_secondaryForce.Force = force;
            }
            else if (force > m_secondaryForce.Force * 1.1f && direction != Base6Directions.GetFlippedDirection(m_primaryForce.Direction))
            {
                Log.DebugLog("stronger than secondary force, direction: " + direction + ", force: " + force + ", acceleration: " + force / myGrid.Physics.Mass + ", secondary: " + m_secondaryForce, Logger.severity.DEBUG);
                m_secondaryForce.Direction = direction;
                m_secondaryForce.Force     = force;
                Standard.SetMatrixOrientation(m_primaryForce.Direction, m_secondaryForce.Direction);
                Gravity.SetMatrixOrientation(m_secondaryForce.Direction, m_primaryForce.Direction);
            }

            //Log.DebugLog("direction: " + direction + "(" + (int)direction + ")" + ", force: " + force);
            return(force);
        }
Пример #26
0
            internal void InvalidateRange(Vector3I lodMin, Vector3I lodMax)
            {
                var cell = new MyCellCoord(m_lodIndex, lodMin);

                for (var it = new Vector3I.RangeIterator(ref lodMin, ref lodMax);
                     it.IsValid(); it.GetNext(out cell.CoordInLod))
                {
                    CellData data;
                    var      id = cell.PackId64();
                    using (m_storedCellDataLock.AcquireSharedUsing())
                    {
                        if (m_storedCellData.TryGetValue(id, out data))
                        {
                            data.State = CellState.Invalid;
                        }
                    }
                }
            }
Пример #27
0
        private static void UpdateBuilders()
        {
            Parallel.ForEach(_dirtyEntities, g => UpdateGridBuilders(g));
            _dirtyEntities.Clear();
            var rem = new HashSet <long>();

            using (_entityLock.AcquireSharedUsing())
                using (_builderLock.AcquireSharedUsing())
                {
                    rem.UnionWith(from e in _bigBuilders where _gridCache.All(en => en.EntityId != e.Key) select e.Key);
                }
            using (_builderLock.AcquireExclusiveUsing())
            {
                foreach (var r in rem)
                {
                    _bigBuilders.Remove(r);
                }
            }
        }
Пример #28
0
        private byte[] SerializePacket(Packet packet)
        {
            PacketInfo info;

            using (m_packetDbLock.AcquireSharedUsing())
                if (!m_registeredPacketsByType.TryGetValue(packet.GetType(), out info))
                {
                    throw new ArgumentException($"Packet type {packet.GetType()} wasn't registered");
                }
            byte[] serialized;
            using (var stream = MemoryStream.CreateEmptyStream(8192))
            {
                stream.Write(info.PacketID);
                packet.WriteTo(stream);
                serialized = m_bufferPool.GetOrCreate(stream.WriteHead);
                Array.Copy(stream.Backing, 0, serialized, 0, stream.WriteHead);
            }
            return(serialized);
        }
Пример #29
0
        private static void Run()
        {
            while (true)
            {
                using (lock_TurretActions.AcquireSharedUsing())
                    if (TurretActions.Count == 0)
                    {
                        break;
                    }

                Action currentItem;
                using (lock_TurretActions.AcquireExclusiveUsing())
                    currentItem = TurretActions.Pop();

                currentItem();
                //logFinished();
            }
            isRunning = false;
        }
Пример #30
0
 public void ApplyActionOnAllActives(Action <T> action)
 {
     using (m_lock.AcquireSharedUsing())
     {
         foreach (var active in m_active)
         {
             action.Invoke(active);
         }
     }
 }