~ubuntu-branches/ubuntu/breezy/ace/breezy

« back to all changes in this revision

Viewing changes to docs/tutorials/013/mld.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad, Benjamin Montgomery, Adam Conrad
  • Date: 2005-09-18 22:51:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge) (0.1.2 woody)
  • Revision ID: james.westby@ubuntu.com-20050918225138-seav22q6fyylb536
Tags: 5.4.7-3ubuntu1
[ Benjamin Montgomery ]
* Added a patch for amd64 and powerpc that disables the compiler
  option -fvisibility-inlines-hidden

[ Adam Conrad ]
* Added DPATCH_OPTION_CPP=1 to debian/patches/00options to make
  Benjamin's above changes work correctly with dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
// mld.h,v 1.7 2003/11/09 20:44:19 dhinton Exp
3
 
 
4
 
#ifndef MLD_H
5
 
#define MLD_H
6
 
 
7
 
#include "ace/config-all.h"
8
 
 
9
 
#if !defined (ACE_LACKS_PRAGMA_ONCE)
10
 
# pragma once
11
 
#endif /* ACE_LACKS_PRAGMA_ONCE */
12
 
 
13
 
#include "ace/Singleton.h"
14
 
#include "ace/Atomic_Op.h"
15
 
#include "ace/Mutex.h"
16
 
 
17
 
/*
18
 
   This is a cheap memory leak detector.  Each class I want to watch over
19
 
   contains an mld object.  The mld object's ctor increments a global counter
20
 
   while the dtor decrements it.  If the counter is non-zero when the program
21
 
   is ready to exit then there may be a leak.
22
 
 */
23
 
 
24
 
class mld
25
 
{
26
 
public:
27
 
    mld (void);
28
 
    ~mld (void);
29
 
 
30
 
    static int value (void);
31
 
 
32
 
protected:
33
 
    static ACE_Atomic_Op < ACE_Mutex, int >counter_;
34
 
};
35
 
 
36
 
// ================================================
37
 
 
38
 
/*
39
 
   Just drop 'MLD' anywhere in your class definition to get cheap memory leak
40
 
   detection for your class.
41
 
 */
42
 
#define MLD            mld mld_
43
 
 
44
 
/*
45
 
   Use 'MLD_COUNTER' in main() to see if things are OK.
46
 
 */
47
 
#define MLD_COUNTER    mld::value()
48
 
 
49
 
// ================================================
50
 
 
51
 
#endif