blob: 34cab1d8637f4936a1914b361c189b5a5a0281b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// $Id$
#include "mmap.h"
int
main (int, char *[])
{
/*
The default behavior of the memory map wrapper is to create
the file if it doesn't exist. This is a minor change from
the SV shared memory wrapper.
*/
ACE_Shared_Memory_MM shm_server (SHM_KEY, SHMSZ);
char *shm = (char *) shm_server.malloc ();
char *s = shm;
ACE_DEBUG ((LM_INFO, "(%P|%t) Memory Mapped file is at 0x%x\n",
shm ));
for (char c = 'a'; c <= 'z'; c++)
*s++ = c;
*s = '\0';
while (*shm != '*')
ACE_OS::sleep (1);
for (s = shm; *s != '\0'; s++)
{
putchar (*s);
}
putchar ('\n');
if (shm_server.remove () < 0)
ACE_ERROR ((LM_ERROR, "%p\n", "remove"));
return 0;
}
|