Esempio n. 1
0
        /// <summary>
        /// Executes all task callbacks for the thread calling this function.
        /// It is thread safe.
        /// </summary>
        public static void RunCallbacks()
        {
            CallbackBuffer.ApplyChanges();
            for (int i = 0; i < CallbackBuffer.Count; ++i)
            {
                WorkItem item = CallbackBuffer[i];

                Debug.Assert(item != null);
                if (item == null)
                {
                    continue;
                }

                if (item.Callback != null)
                {
                    item.Callback();
                    item.Callback = null;
                }
                if (item.DataCallback != null)
                {
                    item.DataCallback(item.WorkData);
                    item.DataCallback = null;
                }
                item.WorkData = null;
                item.Requeue();
            }

            CallbackBuffer.ClearList();
        }
            public void Add(MatrixD worldMatrix, BoundingBox box, Vector4I id, MyVoxelBase voxel)
            {
                if (m_list.Count > 1900)
                {
                    m_list.ClearList();
                }

                voxel = voxel.RootVoxel;
                box.Translate(-voxel.SizeInMetresHalf);
                //box.Translate(voxel.StorageMin);


                m_list.Add(new PredictionInfo
                {
                    Id     = id,
                    Bounds = MyOrientedBoundingBoxD.Create((BoundingBoxD)box, voxel.WorldMatrix),
                    Body   = voxel
                });
            }
Esempio n. 3
0
 public void Dispose()
 {
     m_receivedMsgHandlers.ClearList();
     if (m_active)
     {
         StopServer();   // do not stop server
     }
     if (m_tempBuffer != IntPtr.Zero)
     {
         Marshal.FreeHGlobal(m_tempBuffer);
     }
 }
Esempio n. 4
0
 protected override void Unload()
 {
     MyAPIGateway.Entities.OnEntityAdd -= OnEntityAdd;
     foreach (ControllableGrid grid in _grids)
     {
         DeRegisterGrid(grid);
     }
     _grids.ApplyRemovals();
     _grids.ClearList();
     // Unload code above base
     base.Unload();
 }
        //WorkPriority IPrioritizedWork.Priority
        //{
        //    get { return WorkPriority.VeryLow; }
        //}

        void IWork.DoWork(WorkData workData)
        {
            MySimpleProfiler.Begin("MyDepositQuery.DoWork");
            try
            {
                m_result.ClearList();
                m_emptyCells = new List <Vector3I>();
                var cache = Cache;
                cache.Resize(new Vector3I(MyOreDetectorComponent.CELL_SIZE_IN_LOD_VOXELS));
                var storage = VoxelMap.Storage as IMyStorage;
                if (storage == null || storage.Closed)
                {
                    return;
                }

                Vector3I c;
                for (c.Z = Min.Z; c.Z <= Max.Z; ++c.Z)
                {
                    for (c.Y = Min.Y; c.Y <= Max.Y; ++c.Y)
                    {
                        for (c.X = Min.X; c.X <= Max.X; ++c.X)
                        {
                            if (storage == null || storage.Closed)
                            {
                                break;
                            }

                            ProcessCell(cache, storage, c);
                        }
                    }
                }
                m_result.ApplyChanges();
            }
            finally
            {
                MySimpleProfiler.End();
            }
        }
Esempio n. 6
0
 public override void Close()
 {
     base.Close();
     _gyros.ClearList();
 }
Esempio n. 7
0
 public void ClearLines()
 {
     _drawLines.ClearList();
     _drawLines.ApplyRemovals();
 }
 public override void Close()
 {
     base.Close();
     _landingGears.ClearList();
 }