Hello,
I have a global array that several threads need to read and write from. Do I need to turn semaphores on anytime one of the threads needs to write to the array or ? Each thread would not be writing to the same part of the array at the same time so I was not sure about this. Any help would be appreciated.
Thanks
Will items be added or removed? If so, you should definitely use some form of semaphore. But I’d probably use one anyway.
Hi Kem,
It is a fixed sized array. So only values in the array will be read or changed. Still use a semaphore on all of the writing of new values?
Thanks
I would unless you’re absolutely certain that no two threads will be reading/writing to the same element.
CriticalSections is another choice for this purpose…