DLL static data
I have static data members in the class
I have written to form static libraries.These static libraries are
used to form a Dynamic link library.
Do i need to use SEMAPHORE wile using those static data??
Can you please help me in understanding this with an
example?...Do i need to use semaphore at any other place??
Re: DLL static data
You don't need any kind of mutexing arrangement just to access static data.
If you want to update any kind of data (not just static) in a multithreaded program then you need to serialise access so that different threads do not clash, e.g.:
thread 1: read memory, get value 1
thread 2: read memory, get value 1
thread 1: increase value and write back, storing 2
thread 2: increase value and write back, storing 2
Here we see that two threads have updated the same number, and the result should be 3.
|All times are GMT +5.5. The time now is 00:33.|