Re: TMapFile,TButton

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon May 17 1999 - 16:17:02 MEST


Hi Thomas,

   have you tried the recipe given in the TMapFile source of
TMapFile::SetMapAddress?
The idea is that you, for example, create two mapped files and write down the
starting address for each file. Next in the other program you now connect to
these
files using:

   TMapFile::SetMapAddress(0x40eb9000);
   TMapFile *mfile1 = TMapFile::Create("file1.map");
   TMapFile::SetMapAddress(0x41843000);
   TMapFile *mfile2 = TMapFile::Create("file2.map");

be sure that the "other" program does not have any other objects mapped
in this addess space. Check that by creating a new mapped file in that
process (without mapping any other TMapFile) and check that the map address
of the file is smaller than that of the first program.

Cheers, Fons.


   // Set preferred map address. Find out preferred map address as follows:
   // 1) Run consumer program to find the preferred map address:
   //       $ root
   //       root [0] m = TMapFile::Create("dummy.map", "recreate", 10000000);
   //       root [1] m.Print()
   //       Memory mapped file:   dummy.map
   //       Title:
   //       Option:               CREATE
   //       Mapped Memory region: 0x40b4c000 - 0x40d95f00 (2.29 MB)
   //       Current breakval:     0x40b53000
   //       root [2] .q
   //       $ rm dummy.map
   //    Remember begin of mapped region, i.e. 0x40b4c000
   //
   // 2) Add to producer program, just before creating the TMapFile:
   //       TMapFile::SetMapAddress(0x40b4c000);
   //
   // Repeat this if more than one map file is being used.
   //
Thomas Eberl wrote:
> 
> Dear Rooters,
> 
> I have two questions:
> 
> -- I use TMapFile to work with shared memory (compiled prog). My goal is
> to have two producer processes that write into two different memory
> regions and one consumer that reads from both shared memory areas. I
> have read about SetMapAddress, but I am not sure how to use it here.
> How can I make them coexist ???
> 

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:33 MET