Hi,
I have a structure
typedef struct my_s {
int x;
...
} my_T;
my_t * p_my_t;
I want to set the address of p_my_t
to NULL
, tried:
memset (&p_my_t, 0, sizeof(my_t*))
This does not look right,
what is the correct way of doing this? appreciate it...
Amendment to question - asking a radically more complex question:
Thanks, here is what I am trying to do:
- Two processes, A and B
- malloc p_my_t in A, B has N threads and can access it
- Start deleting in A but I can not simply free it since threads in B may still using it.
- So I call a function, pass address of p_my_t to B to set its address to NULL in B so no other threads in B can use anymore
- After call back from B, I then free memory in A
NB: there is no standard way to manage memory allocations via shared memory between processes. You will have to do some rather careful thinking about what is going on.