fork question
- From: Eric <nospam@xxxxxxxxx>
- Date: Sun, 22 Jan 2006 13:09:59 -0800
if i use fork in my userland app, how do share a global variables between
the parent and all the children? I need to have this variable created such
that if anyone (parent or child) changes it all the other children and the
parent can see the change. My only idea is a mmap'd space, I could let each
process mmap the same space and use it for various shared variables, kind
of like this:
parent: create typedef of layout of mapped space
parent: sp=mmap new shared space based on size of layout
parent: sp->var1 = value
parent: sp->var2 = value
child1: sp=mmap existing shared space
child1: sp->var1 = value
child1: if(sp->var2 == value)...
child2: sp=mmap existing shared space
child2: sp->var1 = value
child2: if(sp->var2 == value)...
Is there another better way?
Thanks
Eric
.
- Follow-Ups:
- Re: fork question
- From: David Schwartz
- Re: fork question
- Prev by Date: Re: Odd error with g++
- Next by Date: Re: fork question
- Previous by thread: Dynamic move between DISPLAYs for one application
- Next by thread: Re: fork question
- Index(es):
Relevant Pages
|