source: trunk/src/kernel32/os2heap.h@ 1118

Last change on this file since 1118 was 1118, checked in by sandervl, 26 years ago

Lots of changes by several people (see changelog for 4 October

File size: 1.6 KB
Line 
1/* $Id: os2heap.h,v 1.4 1999-10-04 09:55:57 sandervl Exp $ */
2
3/*
4 *
5 * Project Odin Software License can be found in LICENSE.TXT
6 *
7 */
8/*
9 * Heap class for OS/2
10 *
11 * Copyright 1998 Sander van Leeuwen
12 *
13 */
14#ifndef __OS2HEAP_H__
15#define __OS2HEAP_H__
16
17#include "vmutex.h"
18
19#define MAGIC_NR_HEAP 0x87654321
20typedef struct _tagHEAPELEM {
21 DWORD magic; //magic number
22 struct _tagHEAPELEM *prev;
23 struct _tagHEAPELEM *next;
24 DWORD flags; //set by LocalAlloc only
25 DWORD lockCnt; //LocalLock/Unlock
26} HEAPELEM;
27
28#define HEAP_OVERHEAD (sizeof(HEAPELEM)+60)
29//#define HEAP_OVERHEAD sizeof(HEAPELEM)
30
31class OS2Heap
32{
33public:
34 OS2Heap(HANDLE hHeap, DWORD flOptions, DWORD dwInitialSize, DWORD dwMaximumSize);
35 ~OS2Heap();
36
37 HANDLE getHeapHandle() { return(hPrimaryHeap); };
38
39 LPVOID Alloc(DWORD dwFlags, DWORD dwBytes);
40 LPVOID ReAlloc(DWORD dwFlags, LPVOID lpMem, DWORD dwBytes);
41 BOOL Free(DWORD dwFlags, LPVOID lpMem);
42 DWORD Size(DWORD dwFlags, PVOID lpMem);
43 DWORD Compact(DWORD dwFlags);
44 BOOL Validate(DWORD dwFlags, LPCVOID lpMem);
45 BOOL Walk(void *lpEntry);
46
47 LPVOID Alloc(DWORD dwFlags, DWORD dwBytes, DWORD LocalAllocFlags);
48 BOOL Lock(LPVOID lpMem);
49 BOOL Unlock(LPVOID lpMem);
50 int GetLockCnt(LPVOID lpMem);
51 DWORD GetFlags(LPVOID lpMem);
52
53 static OS2Heap *find(HANDLE hHeap);
54
55private:
56protected:
57
58 VMutex *hmutex;
59
60 DWORD dwMaximumSize, dwInitialSize, flOptions, totalAlloc, nrHeaps;
61 HANDLE hPrimaryHeap;
62 BOOL fInitialized;
63 HEAPELEM *heapelem;
64
65 OS2Heap *next;
66 static OS2Heap *heap;
67};
68
69#endif
Note: See TracBrowser for help on using the repository browser.