P
Paulo da Silva
Hi.
I am writing a shared library to override some libc
functions.
I have the following questions:
Ex.
int XXX=0;
void f() {++XXX; ...; --XXX;}
1.
Are global data (extern) shared among processes
or threads? If a process or a thread accesses f while
another one is also executing f it sees XXX as 0 or 1?
2.
Is there any problem not freeing malloc allocated areas in f
relying on the automatic free at the end of the job?
I am asking this because I want to share some information
between sucessive calls to f in a process but I don't know what
is the last call. So, I don't know when to free the malloc'ed
areas.
Any links to literature about these is welcome.
Thanks for any help.
I am writing a shared library to override some libc
functions.
I have the following questions:
Ex.
int XXX=0;
void f() {++XXX; ...; --XXX;}
1.
Are global data (extern) shared among processes
or threads? If a process or a thread accesses f while
another one is also executing f it sees XXX as 0 or 1?
2.
Is there any problem not freeing malloc allocated areas in f
relying on the automatic free at the end of the job?
I am asking this because I want to share some information
between sucessive calls to f in a process but I don't know what
is the last call. So, I don't know when to free the malloc'ed
areas.
Any links to literature about these is welcome.
Thanks for any help.