blob: 8bbbc3c7f444ee973b3eb1f3eec5876f1fd23dd3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
--- src/hourglass.h.orig Wed Oct 8 20:26:08 2003
+++ src/hourglass.h Tue Jan 23 05:28:40 2007
@@ -38,6 +38,11 @@
#include <pthread.h>
#include <assert.h>
+#ifdef __FreeBSD__
+#include <machine/cpufunc.h>
+#include <machine/atomic.h>
+#endif
+
#include "config.h"
#define DBGPrint(lev,str) do { \
@@ -197,6 +202,8 @@
cycle_time start, end;
};
+#ifndef __FreeBSD__
+
#ifdef CPU_586
/*
* a bit of documentation since the rdrsc function seems to often be
@@ -228,7 +235,7 @@
static inline int my_InterlockedIncrement (long *dest)
{
- return my_InterlockedExchangeAdd (dest, 1) + 1;
+ return my_InterlockedExchangeAdd (dest, 1L) + 1;
}
#endif /* defined CPU_586 */
@@ -275,6 +282,16 @@
}
#endif /* defined CPU_PPC */
+
+#else
+
+static inline long my_InterlockedIncrement (long *dest)
+{
+ atomic_add_long(dest, 1L);
+ return *dest;
+}
+
+#endif /* !__FreeBSD__ */
static inline sec_time cycle_to_sec (cycle_time c)
{
|