PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework Alternate means for Queue.Synchronized Method

Reply

Alternate means for Queue.Synchronized Method

 
Thread Tools Rate Thread
Old 11-06-2005, 03:44 AM   #1
=?Utf-8?B?Sm9obiBPbGJlcnQ=?=
Guest
 
Posts: n/a
Default Alternate means for Queue.Synchronized Method


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

I have tried the OpenNetCf but without success.

Thanks.
--
John Olbert
javo2000@snet.net

  Reply With Quote
Old 13-06-2005, 05:36 PM   #2
Sergey Bogdanov
Guest
 
Posts: n/a
Default Re: Alternate means for Queue.Synchronized Method

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 ...
}





--
Sergey Bogdanov
http://www.sergeybogdanov.com


John Olbert wrote:
> Is there an alternative under NetCf for Queue.Synchronized Method in the
> Systems.Collection?
>
> I have tried the OpenNetCf but without success.
>
> Thanks.

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off