This project has moved and is read-only. For the latest updates, please go here.

calling DownloadPicture in multiple threads

Topics: User Forum
Dec 15, 2006 at 7:31 PM

I've just extended my app to use multiple background worker threads to get thumbnails, but when i use multiple threads i eventually get this error: +

$exception The process cannot access the file 'C:\\Documents and Settings\\spang\\Local Settings\\Application Data\\FlickrNet\\8731e30f-ddab-4ec5-aefc-e030e0aca940' because it is being used by another process. System.Exception {System.IO.IOException}

my threads are tracing what they are doing and they are not both going for the same url at once. Any ideas?

Dec 15, 2006 at 7:32 PM
just to add, theses are definately being downloaded, not from the cache. I check whether the item is in the cache when the screen is populated and display it instantly if so. everything gets put onto a queue to be got asynchronously by the workers
Dec 15, 2006 at 8:38 PM
some background : i've used the debug dll and the exception occurs in PictureCacheItem::OnItemFlushed
Dec 16, 2006 at 12:03 PM
dont't fret about this too much on my sake, i've completely bypassed the download and cache mechanism for images

using curl for the downloads and built my own filebackedcache. I know the application domain is never going to be asking for the same file twice in different threads so it was damn easy.

also in my cahce implemnentation i broke the cache directory into 2 levels so the file "spang" would get stored as the file

im never happy about putting thousands of files in one directory