public void process() { TryWithLock(texQueue, () => { DateTime end = DateTime.Now.AddMilliseconds(1); while (texQueue.Count() > 0) { TexInfo ti = texQueue.Dequeue(); Texture2D t = ti.t; t.LoadRawTextureData(ti.data); t.Compress(true); t.Apply(true, true); if (DateTime.Now > end) { break; } } while (queuedActions.Count() > 0) { Action a = queuedActions.Dequeue(); a.Invoke(); if (DateTime.Now > end) { break; } } }); }
public void add(TexInfo t) { lock (texQueue) { texQueue.Enqueue(t); } }