コード例 #1
0
        protected Demo(DemosGame game)
        {
            Game = game;
            parallelLooper = new ParallelLooper();
            //This section lets the engine know that it can make use of multithreaded systems
            //by adding threads to its thread pool.
            #if XBOX360
            parallelLooper.AddThread(delegate { Thread.CurrentThread.SetProcessorAffinity(new[] { 1 }); });
            parallelLooper.AddThread(delegate { Thread.CurrentThread.SetProcessorAffinity(new[] { 3 }); });
            parallelLooper.AddThread(delegate { Thread.CurrentThread.SetProcessorAffinity(new[] { 4 }); });
            parallelLooper.AddThread(delegate { Thread.CurrentThread.SetProcessorAffinity(new[] { 5 }); });

            #else
            if (Environment.ProcessorCount > 1)
            {
                for (int i = 0; i < Environment.ProcessorCount; i++)
                {
                    parallelLooper.AddThread();
                }
            }
            #endif

            Space = new Space(parallelLooper);

            game.Camera.LockedUp = Vector3.Up;
            game.Camera.ViewDirection = new Vector3(0, 0, -1);
        }
コード例 #2
0
        internal ParallelLoopWorker(ParallelLooper manager, Action threadStart)
        {
            this.manager = manager;
            this.threadStart = threadStart;

            getToWork = new AutoResetEvent(false);

            thread = new Thread(Work) { IsBackground = true };
            thread.Start();
        }
コード例 #3
0
ファイル: ParallelLoopWorker.cs プロジェクト: tonypeng/Bloxel
        internal ParallelLoopWorker(ParallelLooper manager, Action threadStart)
        {
            this.manager     = manager;
            this.threadStart = threadStart;

            getToWork = new AutoResetEvent(false);

            thread = new Thread(Work)
            {
                IsBackground = true
            };
            thread.Start();
        }
コード例 #4
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            ParallelLooper looper = new ParallelLooper();
            for (int i = 0; i < Environment.ProcessorCount; i++)
            {
                looper.AddThread();
            }

            space = new Space(looper);
            //space.ForceUpdater.Gravity = new BEPUutilities.Vector3(0, -75f, 0);
            Services.AddService(typeof(Space), space);

            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 800;
            graphics.ApplyChanges();
        }
コード例 #5
0
 /// <summary>
 /// Constructs a new specialized thread manager
 /// that manages loops and tasks separately.
 /// </summary>
 public SpecializedThreadManager()
 {
     taskManager = new ThreadTaskManager();
     looper = new ParallelLooper();
 }
コード例 #6
0
 /// <summary>
 /// Constructs a new specialized thread manager
 /// that manages loops and tasks separately.
 /// </summary>
 public SpecializedThreadManager()
 {
     taskManager = new ThreadTaskManager();
     looper      = new ParallelLooper();
 }