Do you have separate processes, or are you using pthreads?


Since all threads within the process share the same memory, all you need is some form of locking (rwlock, mutex, semaphore) or atomic...