Files
tytd2025/Tesses.YouTubeDownloader/src/Queue.tcross
2025-10-15 00:07:35 -05:00

35 lines
589 B
Plaintext

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();
}
}