I have a global variable, X. I then fork and modify X from the child. I want those changes to show up in the parent, but I don’t want the parent to have to wait on the child.
How can I do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to put the variable in shared memory. There are many ways to create shared memory. I’d probably just use
mmap, but you could also check outshmgetorshm_open.