Overview
Comment: | Replace some macros with OF_INLINE functions. This way, there won't be a warning about unused results. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
839f45a2930718de6f3bdaabc620c4dc |
User & Date: | js on 2010-01-30 02:09:07 |
Other Links: | manifest | tags |
Context
2010-01-30
| ||
10:47 | Check return value of of_spinlock_*. check-in: 8a97fac06f user: js tags: trunk | |
02:09 |
Replace some macros with OF_INLINE functions. This way, there won't be a warning about unused results. check-in: 839f45a293 user: js tags: trunk | |
01:50 | Fall back to spinlocks if atomic ops are unavailable. check-in: bd6a71aad3 user: js tags: trunk | |
Changes
Modified src/atomic.h from [a1c4c931ea] to [243643e5ed].
1 2 3 4 5 6 7 8 9 10 11 | 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 | - + - + + + + + + + + + + + | /* * Copyright (c) 2008 - 2009 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ |
︙ |
Modified src/threading.h from [f8a41f877f] to [27e884cfec].
︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | + + + + + + + + + | typedef pthread_key_t of_tlskey_t; #elif defined(_WIN32) #include <windows.h> typedef HANDLE of_thread_t; typedef CRITICAL_SECTION of_mutex_t; typedef DWORD of_tlskey_t; #endif #if defined(OF_ATOMIC_OPS) #import "atomic.h" typedef int32_t of_spinlock_t; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) typedef pthread_spinlock_t of_spinlock_t; #else typedef pthread_mutex_t of_spinlock_t; #endif #if defined(OF_HAVE_PTHREADS) # define of_thread_is_current(t) pthread_equal(t, pthread_self()) # define of_thread_current() pthread_self() #elif defined(_WIN32) # define of_thread_is_current(t) (t == GetCurrentThread()) # define of_thread_current() GetCurrentThread() |
︙ | |||
182 183 184 185 186 187 188 189 | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + - - - - - - + + | #if defined(OF_HAVE_PTHREADS) return (pthread_key_delete(key) ? NO : YES); #elif defined(_WIN32) return (TlsFree(key) ? YES : NO); #endif } static OF_INLINE BOOL of_spinlock_new(of_spinlock_t *s) { #if defined(OF_ATOMIC_OPS) *s = 0; return YES; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return (pthread_spin_init(s, 0) ? NO : YES); #else return of_mutex_new(s); #endif } |