source: proiecte/swift/trunk/lib/hoard-371/src/lockmallocheap.h @ 176

Last change on this file since 176 was 176, checked in by (none), 14 years ago
  • imported repo from "guagal"
File size: 465 bytes
Line 
1#ifndef _LOCKMALLOCHEAP_H_
2#define _LOCKMALLOCHEAP_H_
3
4#include "hldefines.h"
5
6
7// Just lock malloc (unlike LockedHeap, which locks both malloc and
8// free). Meant to be combined with something like RedirectFree, which will
9// implement free.
10
11namespace Hoard {
12
13template <typename Heap>
14class LockMallocHeap : public Heap {
15public:
16  MALLOC_FUNCTION INLINE void * malloc (size_t sz) {
17    HL::Guard<Heap> l (*this);
18    return Heap::malloc (sz);
19  }
20};
21
22}
23
24#endif
Note: See TracBrowser for help on using the repository browser.