Home All Groups Group Topic Archive Search About

Re: framework 1.1 & Queue class

Author
24 Apr 2007 1:24 PM
Brian Gideon
On Apr 24, 5:35 am, Rory Becker <RoryBec...@newsgroup.nospam> wrote:
> I would like to tak an extra question on to this one.
>
> I am interested in using a HashTable in a similar fashion.
>
> I was wondering is the "local sychronized wrapper" technique applicable here?
>

Yes, it works in a similar fashion.

> Likewise will using this synchronised object ensure that I am thread safe
> with regard to my HashTable/Queue?

Yes.  However, the Hashtable was designed to be partially thread-safe
even without the synchronized wrapper.  It is safe to have multiple
readers as long as there is only one writer.  You might be able to use
that to your advantage.

Author
24 Apr 2007 1:42 PM
Rory Becker
Show quote
> On Apr 24, 5:35 am, Rory Becker <RoryBec...@newsgroup.nospam> wrote:
>
>> I would like to tak an extra question on to this one.
>>
>> I am interested in using a HashTable in a similar fashion.
>>
>> I was wondering is the "local sychronized wrapper" technique
>> applicable here?
>>
> Yes, it works in a similar fashion.
>
>> Likewise will using this synchronised object ensure that I am thread
>> safe with regard to my HashTable/Queue?
>>
> Yes.  However, the Hashtable was designed to be partially thread-safe
> even without the synchronized wrapper.  It is safe to have multiple
> readers as long as there is only one writer.  You might be able to use
> that to your advantage.

Excellent Brian.

Thanks for pointing out this benifit. This point will prove very useful

--
Rory

AddThis Social Bookmark Button