I have a number of threads running simultaneously, and one of the lines of code running in each thread is the following:
threadBmp = myBmp.Clone(rect, PixelFormat.Format24bppRgb);
//"myBmp" is a class variable
The problem is that if i do not preceed this statement with:
lock(myBmp)
I get an error saying that the object is in use elsewhere.
Now, aren't all the threads just *reading* from myBmp?! none of them are writing to it, so technically multiple threads should be able to safely access this myBmp simultaneously!
is it possible to allow multiple threads to use this object without waiting on the lock?