/// <summary> /// Wait will wait for the given task to complete, and then dispose /// the context. After Wait() returns, you should do nothing else to /// the context. /// </summary> public void Wait() { if (Worker == null) { throw new ObjectDisposedException("TaskContext.Wait()"); } Worker = null; Event.WaitOne(); ThreadPoolComponent.Reclaim(this); }
public void Dispose() { if (Worker == null) { throw new ObjectDisposedException("TaskContext.Dispose()"); } Worker.Context = null; Worker = null; ThreadPoolComponent.Reclaim(this); }
internal TaskContext(ThreadPoolComponent tpc) { pool_ = tpc; }
internal TaskContext(ThreadPoolComponent tpc) { pool_ = tpc; }
public Shorewood() { graphics = new GraphicsDeviceManager(this); threadPool = new ThreadPoolComponent(this); inputHandler = new InputHandler(this); inputHandler.AddEvent(Buttons.Back, new EventHandler<ButtonFireEventArgs>(OnPause)); inputHandler.AddEvent(Buttons.Start, new EventHandler<ButtonFireEventArgs>(OnPause)); storageScreen = new StorageScreen(this); foundWordAnimator = new FoundWordAnimationRenderer(this); constantBackground = new ConstantBackground(this); fluidSolver = new FluidSolverComponent(this); scoreBox = new ScoreBox(this); particleSystem = new UniversalParticleSystem(this); constantBackground.Enabled = false; constantBackground.Visible = false; foundWordAnimator.Enabled = false; foundWordAnimator.Visible = false; graphics.PreferredBackBufferWidth = PlatformDisplaySettings.width; graphics.PreferredBackBufferHeight = PlatformDisplaySettings.height; fluidSolver.Differences = new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); IsFixedTimeStep = false; Shorewood.Content = base.Content; Content.RootDirectory = "Content"; scale = graphics.PreferredBackBufferHeight / 1000.0f; soundTrack = new SoundTrack(this); ninthPlanetGames = new NinthPlanetGames.SplashScreen(this); ninthPlanetGames.Visible = true; ninthPlanetGames.Enabled = true; bloom = new BloomComponent(this); loadingPosition = (new Vector2(PlatformDisplaySettings.width / 2, PlatformDisplaySettings.height / 2)); graphics.PreparingDeviceSettings += OnPreparingDeviceSettings; ShorewoodPool.InitalizePools(); physicsEngine = new PhysicsSimulator(new Vector2(0, 100)); #if XBOX services = new GamerServicesComponent(this); Components.Add(services); #endif Components.Add(threadPool); storage = new StorageHandler(); Components.Add(inputHandler); Components.Add(storage.sharedSaveDevice); Components.Add(soundTrack); Components.Add(fluidSolver); Components.Add(ninthPlanetGames); avatar2DAnimation = new Avatar2DAnimation(this); Components.Add(avatar2DAnimation); //Components.Add(ietGames); }