[TriLUG] shared libraries aren't shared
Joseph Mack NA3T
jmack at wm7d.net
Wed Nov 11 16:36:56 EST 2009
On Wed, 11 Nov 2009, Alan Porter wrote:
>
> That is not how shared libraries work (thank goodness).
did they used to work this way?
So shared globals in libraries is process safe, but not
thread safe?
> But there are two copies of the data segment, one for each
> application.
so there's two BSS's. Didn't know that.
if instead of having a global variable in the library code,
I have
#include <stdio.h>
void print_int(void){
static int j;
++j;
printf ("j=%d \n", j);
}
I still don't get a race condition when used by two
executables. Is the static int j stored in its own data
segment too?
Thanks Joe
--
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!
More information about the TriLUG
mailing list