mirror of
git://opensimulator.org/git/opensim
synced 2026-08-14 09:02:50 +00:00
Currently the vm is at a early stage and very limited: currently only supports static methods (instance methods support is nearly finished though) currently a class can't have member variables, so currently only local variables in the methods. Also in this branch, connecting the vm to opensim is not completely finished: it is being uploaded just for viewing purposes.
34 lines
743 B
C#
34 lines
743 B
C#
using System;
|
|
using System.Threading;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace OpenSim.Framework.Utilities
|
|
{
|
|
public class BlockingQueue<T>
|
|
{
|
|
private Queue<T> _queue = new Queue<T>();
|
|
private object _queueSync = new object();
|
|
|
|
public void Enqueue(T value)
|
|
{
|
|
lock (_queueSync)
|
|
{
|
|
_queue.Enqueue(value);
|
|
Monitor.Pulse(_queueSync);
|
|
}
|
|
}
|
|
|
|
public T Dequeue()
|
|
{
|
|
lock (_queueSync)
|
|
{
|
|
if (_queue.Count < 1)
|
|
Monitor.Wait(_queueSync);
|
|
|
|
return _queue.Dequeue();
|
|
}
|
|
}
|
|
}
|
|
}
|