00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020
00021 #ifndef _ARCH_SPECIFIC_H_
00022 #define _ARCH_SPECIFIC_H_
00023
00024 #include "config.h"
00025
00026 #include <pthread.h>
00027 #include <unistd.h>
00028
00029
00030 #if USER_LOCKS && (defined(i386) || defined(sparc) || defined(__sgi))
00031 typedef unsigned long hoardLockType;
00032 #else
00033 typedef pthread_mutex_t hoardLockType;
00034 #endif
00035
00036 typedef pthread_t hoardThreadType;
00037
00038
00039 extern "C" {
00040
00042
00043 void hoardCreateThread (hoardThreadType& t,
00044 void *(*function) (void *),
00045 void * arg);
00046 void hoardJoinThread (hoardThreadType& t);
00047 void hoardSetConcurrency (int n);
00048
00049
00050
00051
00052 int hoardGetThreadID (void);
00053
00055
00056 #if !USER_LOCKS
00057
00058
00059
00060 inline void hoardLockInit (hoardLockType& lock) {
00061 pthread_mutex_init (&lock, NULL);
00062 }
00063
00064 inline void hoardLock (hoardLockType& lock) {
00065 pthread_mutex_lock (&lock);
00066 }
00067
00068 inline void hoardUnlock (hoardLockType& lock) {
00069 pthread_mutex_unlock (&lock);
00070 }
00071
00072 #endif
00073
00074 inline void hoardLockDestroy (hoardLockType&) {
00075 }
00076
00078
00079 int hoardGetPageSize (void);
00080 void * hoardGetMemory (long size);
00081 void hoardFreeMemory (void * ptr);
00082
00084
00085 void hoardYield (void);
00086 int hoardGetNumProcessors (void);
00087 unsigned long hoardInterlockedExchange (unsigned long * oldval,
00088 unsigned long newval);
00089 }
00090
00091 #endif // _ARCH_SPECIFIC_H_
00092