Re: fork question
- From: Eric <nospam@xxxxxxxxx>
- Date: Tue, 24 Jan 2006 22:37:24 -0800
David Schwartz wrote:
>
> "Eric" <nospam@xxxxxxxxx> wrote in message
> news:VLednYl3AqJrZU7eRVn-gA@xxxxxxxxxxxxxx
>
>> Well, most of it is that the child reads parent set data, but also, i
>> have a
>> couple of shared ints that can be set by anyone which are used as yes/no
>> flags. once set, they never change but are read (ie checked) fairly often
>> by the reset of the processes.
>
> If they're set before the call to 'fork' and never change, they don't
> need to be shared. There's no problem with the child making its own copy
> during the call to 'fork'.
>
>> Another q.
>> I'm creating the mmap'd are like this (shortened for clarity):
>>
>> Global declarations:
>> void *mptr;
>> typedef struct _TSharedAreaMap {
>> struct info sinfo[MAX_SINFOs];
>> int Flag1;
>> volatile int AbortOps;
>> }TSharedAreaMap;
>> TSharedAreaMap *SharedAreaMap;
>>
>> Mapping function:
>> fd = open(SharedBackingFile, O_RDWR);
>> mptr = mmap(0, Len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
>> SharedAreaMap = (TSharedAreaMap *)mptr;
>>
>> Parent and child both call this but only the parent creates the backing
>> file. Is that corect?
>
> Why should both parent and child call that? Why not just call it
> before
> you 'fork'?
>
> DS
Yup, there's a bug! Thanks, I fixed that and its running much better
Eric
.
- References:
- fork question
- From: Eric
- Re: fork question
- From: David Schwartz
- Re: fork question
- From: Eric
- Re: fork question
- From: David Schwartz
- fork question
- Prev by Date: running at boot time & signals
- Next by Date: DNS serrver update via client?
- Previous by thread: Re: fork question
- Next by thread: Re: POSIX Timers on Linux 2.4
- Index(es):
Relevant Pages
|