I've written a custom module and now wish to use a timer_route to do some processing.
I'm using shm_malloc() to store some information in memory while in a "SIP receiver" and want access to the information in the timer thread. My first attempt at getting this to work was to save the address returned by shm_malloc into a static external variable; limiting the scope to the functions in the opensips module I created.
I then fired up opensips with a configuration that include a timer_route that called one of the exported functions in my module.
Unfortunately, it's apparent that the two processes are unable to exchange the information in this way. This is confusing to me since I thought a child processes inherit the attached shared memory.
Any hints on another approach?
Kevin, you should allocate the shared mem chunk BEFORE the timer and worker processes are forked (so that all of them will inherit the variable with the pointer to the chunk) - you should do that in module init function, which is executed before any forking.
Thanks, that has gotten me *much* further!