Geeks With Blogs

News



Add to Google

Tim Hibbard CEO for EnGraph software

I have a situation where it is possible that two threads may try to access the same file. I am thinking about putting the filename in an arraylist when it is being accessed and then removing the filename when the process is finished. But now I have two threads using the same arraylist. I thought about using a SyncLock on the arraylist before I look to see if the filename is in there, but I've read that is a dangerous habit. Anybody have any thoughts?

Posted on Wednesday, February 16, 2005 3:23 PM | Back to top


Comments on this post: Using SyncLock

# re: Using SyncLock
Requesting Gravatar...
In case you haven't come across this already, then maybe this should help:
http://www.yoda.arachsys.com/csharp/threads/lockchoice.shtml

its in C# = shows how to use the lock statement (SynLock in VB.NET).
Left by Imran Koradia on Feb 17, 2005 9:23 AM

# re: Using SyncLock
Requesting Gravatar...
Thanks...i ended up reworking the application to avoid the problem entirely.
Left by Tim Hibbard on Feb 18, 2005 1:40 AM

# re: Using SyncLock
Requesting Gravatar...
do it.
Left by No on May 21, 2007 2:20 PM

# re: Using SyncLock
Requesting Gravatar...
Left by LED downlights on Jul 16, 2011 1:31 AM

Your comment:
 (will show your gravatar)


Copyright © Tim Hibbard | Powered by: GeeksWithBlogs.net