Hi Frank,
If there are multi-threading in your code to access it, you can design it
well,
making them visit it synchronization.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
| From: "Frank Oquendo" <franko@acadx.com>
| References: <ORrz3M6gDHA.1008@TK2MSFTNGP12.phx.gbl>
<OoZD337gDHA.1700@TK2MSFTNGP10.phx.gbl>
<usPDeT8gDHA.524@tk2msftngp13.phx.gbl>
<CMmY1f9gDHA.1544@cpmsftngxa06.phx.gbl>
| Subject: Re: What is the best way to make extended IEnumerator safe?
| Date: Fri, 26 Sep 2003 09:03:30 -0500
| Lines: 16
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <ehat6cDhDHA.1008@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: unassigned-207-178-108-33.hubris.net 207.178.108.33
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:187546
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Thus spake Jeffrey Tan[MSFT]:
|
| > But now, for thread safety, I think you should lock the entire
| > collection while enumerating.
|
| If the collection is locked, only the current thread would be capable of
| modifying it. So if it's your own code that's modifying the collection
| during iteration, how are you going to miss it?
|
| --
| There are 10 kinds of people. Those who understand binary and those who
| don't.
|
|
http://code.acadx.com
|
|
|