Alternate means for Queue.Synchronized Method

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there an alternative under NetCf for Queue.Synchronized Method in the
Systems.Collection?

I have tried the OpenNetCf but without success.

Thanks.
 
There is no SynchronizedQueue in CF.NET. But if you really need this you
can write the Decorator class like this:

private class SynchronizedQueue : Queue
{
object _syncObj;
Queue _q;

public SynchronizedQueue(Queue q)
{
_syncObj = q.SyncRoot;
_q = q;
}

public override void Enqueue(object v)
{
lock(_syncObj)
{
this._q.Enqueue(v);
}
}

... other methods ...
}
 
Back
Top