summaryrefslogtreecommitdiff
path: root/docs/tutorials/019/client2.cpp
blob: fc74d92bea05da24db97958179ebe490721f57fd (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

// $Id$

#include "shmem.h"

int main (int, char *[])
{
    ACE_Shared_Memory_SV shm_client (SHM_KEY, sizeof(SharedData));
    
    char *shm = (char *) shm_client.malloc ();

    ACE_DEBUG ((LM_INFO, "(%P|%t) Shared Memory is at 0x%x\n",
                shm ));

        /*
          More placement new.  The constructor parameter prevents
          clobbering what the server may have written with it's show() 
          method.
        */
    SharedData * sd = new(shm) SharedData(0);

        // Show it
    sd->show();
        // Change it
    sd->set();
        // Advertise it
    sd->available(1);

    shm_client.close();
        
    return 0;
}