1///-*-C++-*-//////////////////////////////////////////////////////////////////
2//
3// Hoard: A Fast, Scalable, and Memory-Efficient Allocator
4//        for Shared-Memory Multiprocessors
5// Contact author: Emery Berger, http://www.cs.utexas.edu/users/emery
6//
7// Copyright (c) 1998-2000, The University of Texas at Austin.
8//
9// This library is free software; you can redistribute it and/or modify
10// it under the terms of the GNU Library General Public License as
11// published by the Free Software Foundation, http://www.fsf.org.
12//
13// This library is distributed in the hope that it will be useful, but
14// WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16// Library General Public License for more details.
17//
18//////////////////////////////////////////////////////////////////////////////
19
20#ifndef _ARCH_SPECIFIC_H_
21#define _ARCH_SPECIFIC_H_
22
23#include "config.h"
24
25#include <new>
26
27#include <OS.h>
28#include <assert.h>
29
30#include <locks.h>
31
32
33// TODO: some kind of adaptive mutex (i.e. trying to spin for a while before
34//  may be a better choice
35typedef mutex hoardLockType;
36
37namespace BPrivate {
38
39///// Lock-related wrappers.
40
41void hoardLockInit(hoardLockType &lock, const char *name);
42void hoardLock(hoardLockType &lock);
43void hoardUnlock(hoardLockType &lock);
44
45///// Memory-related wrapper.
46
47void *hoardSbrk(long size);
48void hoardUnsbrk(void *ptr, long size);
49
50///// Other.
51
52void hoardYield(void);
53
54}	// namespace BPrivate
55
56#endif // _ARCH_SPECIFIC_H_
57