public void Run() { this.OnStart("Starting..."); while (true) { for (int i = 0; i < this._speed; i++) { if (this._storageCheck()) { LagerObject obj = new LagerObject(); this._push(obj); this.OnCreate("Created new object (" + obj.Id + ")"); } } this.OnSleep("Sleeping for 1000 milliseconds"); Thread.Sleep(1000); } }
protected void Push(LagerObject o) { lock (this) { this._storage.Push(o); } }