Article View: borland.public.csharpbuilder.language.csharp
Article #581Re: Object locking using ReaderWriterLock
From: Sunil.P.Thomas
Date: Fri, 13 Aug 2004 04:22
Date: Fri, 13 Aug 2004 04:22
31 lines
1967 bytes
1967 bytes
Hi Marc ,
Thanks for your comment.
I thought execution of
string sess = _loggedUsers[usn];
will throw an exception if multiple threads are accessing it
simultaneously while one is updating the collection and others are reading
from it.
Thanks & Regards
Sunil
"Marc Rohloff [TeamB]" <"on request"> wrote in message
news:guf6jqqsd06y.dlg@marcrohloff.40tude.net...
> On Thu, 12 Aug 2004 18:40:11 +0530, Sunil.P.Thomas wrote:
>
> > Hi Marc ,
> > What will happen if
> > string sess = _loggedUsers[usn];
> > &
> > _loggedUsers.Remove(usn) will be called simultaneously
(Which
> > is a part of RemoveUser() method).
>
> As far as I understand (and I admit to not being a multithreading
> expert) depending on the race condition 'sess' will either be null or
> the session string.
>
> --
> Marc Rohloff [TeamB]
> marc rohloff at myrealbox dot com
Technical Details
Message-ID:
<411c4079$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<411af77e$1@newsgroups.borland.com> <1ggdzdtzuzi58$.dlg@marcrohloff.40tude.net> <411b6aef$1@newsgroups.borland.com> <guf6jqqsd06y.dlg@marcrohloff.40tude.net>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,c5e969dc4a2fb0d X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Sunil.P.Thomas" <sunil@netlinkindia.com> Newsgroups: borland.public.csharpbuilder.language.csharp References: <411af77e$1@newsgroups.borland.com> <1ggdzdtzuzi58$.dlg@marcrohloff.40tude.net> <411b6aef$1@newsgroups.borland.com> <guf6jqqsd06y.dlg@marcrohloff.40tude.net> Subject: Re: Object locking using ReaderWriterLock Date: Fri, 13 Aug 2004 09:52:09 +0530 Lines: 33 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 202.144.28.122 Message-ID: <411c4079$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1092370553 202.144.28.122 (12 Aug 2004 21:15:53 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail