Click to See Complete Forum and Search --> : CCriticalSection and array elements


David Janda
July 8th, 1999, 02:18 PM
If say, I have an array of CStrings which is being accessed by two threads, is it possible to lock individual elements of that array?

The idea being not to lock up the entire array.

If this is possible, could someone post a simple example?

Many thanks

DJ

spotteddog
July 8th, 1999, 02:28 PM
Yes, if you can control how access is gained to the array.
One way would be to build your own array class and aggregate or privately
derive from an exisiting array class. Then in your classes [], getElementAt(),
or whatever method, insert your critical section. It really depends on how fancy you want to get;-)