class TYTD.Queue { private ls = []; private mtx = new Muxex(); public getCount() { this.mtx.Lock(); var c = this.ls.Count; this.mtx.Unlock(); return c; } public Pop() { var item = null; this.mtx.Lock(); if(this.ls.Count > 0) { item = ls[ls.Count-1]; this.ls.RemoveAt(ls.Count-1); } this.mtx.Unlock(); return item; } public Push(val) { this.mtx.Lock(); this.ls.Add(val); this.mtx.Unlock(); } }