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