Changeset 919b09a62be1e318c5b142de70468c11e8fc980e
- Timestamp:
- 12/17/07 19:03:15
(10 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1197918195 +0000
- git-parent:
[c105913d38157700cbb9fbc7f0f6f8a7b18de103]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1197918195 +0000
- Message:
umm.. that last commit was junk, I should work on one machine... This compiles on OpenBSD
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
rc105913 |
r919b09a |
|
36 | 36 | noitd: make-subdirs $(OBJS) |
---|
37 | 37 | $(CC) -o $@ $(OBJS) \ |
---|
| 38 | $(LDFLAGS) \ |
---|
38 | 39 | -Leventer -leventer \ |
---|
39 | 40 | -Lutils -lnoit_utils \ |
---|
40 | | -Ljlog -ljlog |
---|
| 41 | -Ljlog -ljlog \ |
---|
| 42 | $(LIBS) |
---|
41 | 43 | |
---|
42 | 44 | .c.o: |
---|
… | … | |
45 | 47 | clean-subdirs: |
---|
46 | 48 | for dir in $(SUBS) ; do \ |
---|
47 | | make -C $$dir clean ; \ |
---|
| 49 | (cd $$dir && make clean) ; \ |
---|
48 | 50 | done |
---|
49 | 51 | |
---|
rb62cf2b |
r919b09a |
|
28 | 28 | |
---|
29 | 29 | int eventer_choose(const char *name) { |
---|
30 | | int i; |
---|
31 | 30 | eventer_impl_t choice; |
---|
32 | 31 | for(choice = registered_eventers[0]; choice; choice++) { |
---|
r1452e33 |
r919b09a |
|
9 | 9 | #include "noit_config.h" |
---|
10 | 10 | |
---|
11 | | typedef int32_t noit_atomic_t; |
---|
| 11 | typedef int32_t noit_atomic32_t; |
---|
12 | 12 | typedef int64_t noit_atomic64_t; |
---|
13 | 13 | |
---|
… | … | |
30 | 30 | #elif defined(__GNUC__) |
---|
31 | 31 | |
---|
32 | | typedef u_int32_t noit_atomic32_t |
---|
33 | | typedef u_int64_t noit_atomic64_t |
---|
34 | | |
---|
35 | 32 | #if (SIZEOF_VOID_P == 4) |
---|
36 | 33 | #define noit_atomic_casptr(a,b,c) noit_atomic_cas32((a),(void *)(b),(void *)(c)) |
---|
… | … | |
41 | 38 | #endif |
---|
42 | 39 | |
---|
| 40 | typedef noit_atomic32_t noit_spinlock_t; |
---|
| 41 | |
---|
43 | 42 | static inline noit_atomic32_t |
---|
44 | | noit_atomic_cas32(volatile noit_atomic32_t *ptr |
---|
| 43 | noit_atomic_cas32(volatile noit_atomic32_t *ptr, |
---|
45 | 44 | volatile noit_atomic32_t rpl, |
---|
46 | 45 | volatile noit_atomic32_t curr) { |
---|
… | … | |
56 | 55 | #ifdef __x86_64__ |
---|
57 | 56 | static inline noit_atomic64_t |
---|
58 | | noit_atomic_cas64(volatile noit_atomic64_t *ptr |
---|
| 57 | noit_atomic_cas64(volatile noit_atomic64_t *ptr, |
---|
59 | 58 | volatile noit_atomic64_t rpl, |
---|
60 | 59 | volatile noit_atomic64_t curr) { |
---|
… | … | |
69 | 68 | #else |
---|
70 | 69 | static inline noit_atomic64_t |
---|
71 | | noit_atomic_cas64(volatile noit_atomic64_t *ptr |
---|
| 70 | noit_atomic_cas64(volatile noit_atomic64_t *ptr, |
---|
72 | 71 | volatile noit_atomic64_t rpl, |
---|
73 | 72 | volatile noit_atomic64_t curr) { |
---|
… | … | |
87 | 86 | #endif |
---|
88 | 87 | |
---|
| 88 | static inline void noit_spinlock_lock(volatile noit_spinlock_t *lock) { |
---|
| 89 | while(noit_atomic_cas32(lock, 1, 0) != 0); |
---|
| 90 | } |
---|
| 91 | static inline void noit_spinlock_unlock(volatile noit_spinlock_t *lock) { |
---|
| 92 | while(noit_atomic_cas32(lock, 0, 1) != 1); |
---|
| 93 | } |
---|
| 94 | static inline noit_spinlock_trylock(volatile noit_spinlock_t *lock) { |
---|
| 95 | return (noit_atomic_cas32(lock, 1, 0) == 0); |
---|
| 96 | } |
---|
| 97 | |
---|
89 | 98 | #else |
---|
90 | 99 | #error Please stub out the atomics section for your platform |
---|