home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pipex!unipalm!uknet!mcsun!sunic!seunet!enea!ermes!eny
- From: eny@ermes.enea.se (Erik Nykvist)
- Newsgroups: comp.lang.c++
- Subject: Re: Linked Lists in Shared Memory:
- Message-ID: <1992Nov10.114435.22735@ermes.enea.se>
- Date: 10 Nov 92 11:44:35 GMT
- References: <1992Nov6.185024.14778@lsil.com>
- Organization: Project ERMES, Teli Telecom Sweden
- Lines: 60
-
- ameesh@lsil.com (Ameesh Desai) writes:
- > In article 17760@ermes.enea.se, eny@ermes.enea.se (Erik Nykvist) writes:
- >
- > [stuff deleted]
- >
- > >
- > >I have used a technique based on the new-operator with placement-syntax.
- > >If we have objects that can only be accessed by one process at the time it
- > >is possible to adjust the this-pointer using this operator.
- > >
- > >As long as the constructor used doesn't mutate the data members the affect of
- > >using this operator is only adjustment of the vtbl-pointer.
- > >
- >
- > [ stuff deleted ]
- >
- > >// We also use the placement syntax to allocate the shared object.
- > >=========
- > >PROCESS 1
- > >=========
- > >{
- > > Shared* sp = new (shared_mem) Shared;
- > > Lock lock(*sp);
- > > // Adjust vtbl
- > > new (shared_mem) Shared(IN_SHARED_MEMORY);
- >
- >
- > I am confused ... do you plan to allow creation of the object in one process and
- > its access in another. If so I am not sure what effect the above new statement
- > has - how does it fix the vtbl ? How does it effect the 'this' ptr - which 'this' ?
- >
- > [stuff deleted]
- > >
- > >Erik Nyquist, ENEA DATA AB, erny@enea.se
- > > eny@ermes.enea.se
- >
- I understand that you are confused as I haven't delivered an example
- program.
-
- The proposed technique uses the new-operator with placement-syntax to
- fix the vtbl-pointer in the object.
- I have not thought about this very much. I have written ONE example
- program that uses this.
- My idea is that if you know the address of the object in shared memory
- you could access it after having fixed the vtbl-pointer.
- If you fork your process it is NOT necessary to fix the vtbl-pointer
- because the forked process has the vtbl at the same address as the
- parent process.
-
- Erik Nyquist
-
- >
- > Ameesh
- >
- > ---
- > ______________________________ o__
- > | _ /| Ameesh Desai \ ,>/_
- > | \`O.o' LSI Logic Corp. \__(_)`(_)_ email: ameesh@lsil.com
- > | =(_|_)= MS E192, 1501 McCarthy Blvd. \ fax : (408) 433-6802
- > |____U_______Milpitas, CA 95035____________\____________voice: (408) 433-4097
-