OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | 5 |
6 /* GLOBAL FUNCTIONS: | 6 /* GLOBAL FUNCTIONS: |
7 ** DESCRIPTION: | 7 ** DESCRIPTION: |
8 ** PR Atomic operations | 8 ** PR Atomic operations |
9 */ | 9 */ |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 #elif ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && \ | 103 #elif ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && \ |
104 ((defined(__APPLE__) && \ | 104 ((defined(__APPLE__) && \ |
105 (defined(__ppc__) || defined(__i386__) || defined(__x86_64__))) || \ | 105 (defined(__ppc__) || defined(__i386__) || defined(__x86_64__))) || \ |
106 (defined(__linux__) && \ | 106 (defined(__linux__) && \ |
107 ((defined(__i386__) && \ | 107 ((defined(__i386__) && \ |
108 defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) || \ | 108 defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) || \ |
109 defined(__ia64__) || defined(__x86_64__) || \ | 109 defined(__ia64__) || defined(__x86_64__) || \ |
110 (defined(__powerpc__) && !defined(__powerpc64__)) || \ | 110 (defined(__powerpc__) && !defined(__powerpc64__)) || \ |
111 (defined(__arm__) && \ | 111 (defined(__arm__) && \ |
112 defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) || \ | 112 defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) || \ |
113 defined(__alpha)))) | 113 defined(__aarch64__) || defined(__alpha)))) |
114 | 114 |
115 /* | 115 /* |
116 * Because the GCC manual warns that some processors may support | 116 * Because the GCC manual warns that some processors may support |
117 * reduced functionality of __sync_lock_test_and_set, we test for the | 117 * reduced functionality of __sync_lock_test_and_set, we test for the |
118 * processors that we believe support a full atomic exchange operation. | 118 * processors that we believe support a full atomic exchange operation. |
119 */ | 119 */ |
120 | 120 |
121 #define PR_ATOMIC_INCREMENT(val) __sync_add_and_fetch(val, 1) | 121 #define PR_ATOMIC_INCREMENT(val) __sync_add_and_fetch(val, 1) |
122 #define PR_ATOMIC_DECREMENT(val) __sync_sub_and_fetch(val, 1) | 122 #define PR_ATOMIC_DECREMENT(val) __sync_sub_and_fetch(val, 1) |
123 #define PR_ATOMIC_SET(val, newval) __sync_lock_test_and_set(val, newval) | 123 #define PR_ATOMIC_SET(val, newval) __sync_lock_test_and_set(val, newval) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 ** PR_SUCCESS - if successfully deleted | 190 ** PR_SUCCESS - if successfully deleted |
191 ** PR_FAILURE - if the stack is not empty | 191 ** PR_FAILURE - if the stack is not empty |
192 ** PR_GetError will return | 192 ** PR_GetError will return |
193 ** PR_INVALID_STATE_ERROR - stack i
s not empty | 193 ** PR_INVALID_STATE_ERROR - stack i
s not empty |
194 */ | 194 */ |
195 NSPR_API(PRStatus) PR_DestroyStack(PRStack *stack); | 195 NSPR_API(PRStatus) PR_DestroyStack(PRStack *stack); |
196 | 196 |
197 PR_END_EXTERN_C | 197 PR_END_EXTERN_C |
198 | 198 |
199 #endif /* pratom_h___ */ | 199 #endif /* pratom_h___ */ |
OLD | NEW |