home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 16042 < prev    next >
Encoding:
Internet Message Format  |  1992-11-10  |  2.4 KB

  1. Path: sparky!uunet!pipex!unipalm!uknet!mcsun!sunic!seunet!enea!ermes!eny
  2. From: eny@ermes.enea.se (Erik Nykvist)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Linked Lists in Shared Memory:
  5. Message-ID: <1992Nov10.114435.22735@ermes.enea.se>
  6. Date: 10 Nov 92 11:44:35 GMT
  7. References: <1992Nov6.185024.14778@lsil.com>
  8. Organization: Project ERMES, Teli Telecom Sweden
  9. Lines: 60
  10.  
  11. ameesh@lsil.com (Ameesh Desai) writes:
  12. > In article 17760@ermes.enea.se, eny@ermes.enea.se (Erik Nykvist) writes:
  13. > [stuff deleted]
  14. > >
  15. > >I have used a technique based on the new-operator with placement-syntax.
  16. > >If we have objects that can only be accessed by one process at the time it
  17. > >is possible to adjust the this-pointer using this operator.
  18. > >
  19. > >As long as the constructor used doesn't mutate the data members the affect of
  20. > >using this operator is only adjustment of the vtbl-pointer.
  21. > >
  22. > [ stuff deleted ]
  23. > >// We also use the placement syntax to allocate the shared object.
  24. > >=========
  25. > >PROCESS 1
  26. > >=========
  27. > >{
  28. > >    Shared* sp = new (shared_mem) Shared;
  29. > >    Lock lock(*sp);
  30. > >    // Adjust vtbl
  31. > >    new (shared_mem) Shared(IN_SHARED_MEMORY);
  32. > I am confused ... do you plan to allow creation of the object in one process and
  33. > its access in another. If so I am not sure what effect the above new statement
  34. > has - how does it fix the vtbl ? How does it effect the 'this' ptr - which 'this' ?
  35. > [stuff deleted]
  36. > >
  37. > >Erik Nyquist, ENEA DATA AB,     erny@enea.se
  38. > >                eny@ermes.enea.se
  39. I understand that you are confused as I haven't delivered an example
  40. program. 
  41.  
  42. The proposed technique uses the new-operator  with placement-syntax to
  43. fix the vtbl-pointer in the object. 
  44. I have not thought about this very much. I have written ONE example
  45. program that uses this. 
  46. My idea is that if you know the address of the object in shared memory
  47. you could access it after having fixed the vtbl-pointer.
  48. If you fork your process it is NOT necessary to fix the vtbl-pointer
  49. because the forked process has the vtbl at the same address as the
  50. parent process.
  51.  
  52. Erik Nyquist
  53.  
  54. > Ameesh
  55. > ---
  56. > ______________________________     o__            
  57. > | _   /|     Ameesh Desai     \    ,>/_                              
  58. > | \`O.o'     LSI Logic Corp.   \__(_)`(_)_              email: ameesh@lsil.com
  59. > | =(_|_)=    MS E192, 1501 McCarthy Blvd. \             fax  : (408) 433-6802
  60. > |____U_______Milpitas, CA 95035____________\____________voice: (408) 433-4097 
  61.