Overview
Comment: | Coding style |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
ff23684e9ddcc7f4a49f35755f2e9fee |
User & Date: | js on 2014-07-16 15:16:27 |
Other Links: | manifest | tags |
Context
2014-07-16
| ||
17:02 | Fix check in -[OFDictionary_hashtable isEqual:] check-in: 2ecede1f96 user: js tags: trunk | |
15:16 | Coding style check-in: ff23684e9d user: js tags: trunk | |
2014-07-10
| ||
07:35 | OFHTTPClient: Minor improvements check-in: 4b8c4cac59 user: js tags: trunk | |
Changes
Modified src/threading.h from [c4677d1bcf] to [90da9579d7].
︙ | ︙ | |||
86 87 88 89 90 91 92 | # error of_thread_current not implemented! #endif static OF_INLINE bool of_thread_new(of_thread_t *thread, id (*function)(id), id data) { #if defined(OF_HAVE_PTHREADS) | | | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | # error of_thread_current not implemented! #endif static OF_INLINE bool of_thread_new(of_thread_t *thread, id (*function)(id), id data) { #if defined(OF_HAVE_PTHREADS) return (pthread_create(thread, NULL, (void*(*)(void*))function, (__bridge void*)data) == 0); #elif defined(_WIN32) *thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)function, (__bridge void*)data, 0, NULL); return (thread != NULL); #else # error of_thread_new not implemented! #endif } static OF_INLINE bool of_thread_join(of_thread_t thread) { #if defined(OF_HAVE_PTHREADS) void *ret; if (pthread_join(thread, &ret) != 0) return false; # ifdef PTHREAD_CANCELED return (ret != PTHREAD_CANCELED); # else return true; # endif |
︙ | ︙ | |||
226 227 228 229 230 231 232 | #endif } static OF_INLINE bool of_mutex_unlock(of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) | | | | 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 | #endif } static OF_INLINE bool of_mutex_unlock(of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) return (pthread_mutex_unlock(mutex) == 0); #elif defined(_WIN32) LeaveCriticalSection(mutex); return true; #else # error of_mutex_unlock not implemented! #endif } static OF_INLINE bool of_condition_new(of_condition_t *condition) { #if defined(OF_HAVE_PTHREADS) return (pthread_cond_init(condition, NULL) == 0); #elif defined(_WIN32) condition->count = 0; if ((condition->event = CreateEvent(NULL, FALSE, 0, NULL)) == NULL) return false; return true; |
︙ | ︙ | |||
490 491 492 493 494 495 496 | #ifdef OF_HAVE_RECURSIVE_PTHREAD_MUTEXES static OF_INLINE bool of_rmutex_new(of_mutex_t *mutex) { pthread_mutexattr_t attr; | | | | | | 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | #ifdef OF_HAVE_RECURSIVE_PTHREAD_MUTEXES static OF_INLINE bool of_rmutex_new(of_mutex_t *mutex) { pthread_mutexattr_t attr; if (pthread_mutexattr_init(&attr) != 0) return false; if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) return false; if (pthread_mutex_init(mutex, &attr) != 0) return false; if (pthread_mutexattr_destroy(&attr) != 0) return false; return true; } # define of_rmutex_lock of_mutex_lock # define of_rmutex_trylock of_mutex_trylock |
︙ | ︙ |