Overview
Comment: | Replace a few init methods with constructors. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c34d45798bdce9873ec9893e8ea26be4 |
User & Date: | js on 2012-08-04 08:29:06 |
Other Links: | manifest | tags |
Context
2012-08-04
| ||
09:39 | Fix tests/objc_sync/Makefile. check-in: 1f0e6b6fb0 user: js tags: trunk | |
08:29 | Replace a few init methods with constructors. check-in: c34d45798b user: js tags: trunk | |
00:51 | Add -[OFArray arrayByRemovingObject:]. check-in: 96bbfb777c user: js tags: trunk | |
Changes
Modified src/OFObject.m from [6f60ff9dfc] to [ef2b5b53fe].
︙ | ︙ | |||
90 91 92 93 94 95 96 | static SEL cxx_construct = NULL; static SEL cxx_destruct = NULL; size_t of_pagesize; size_t of_num_cpus; | < < < < < | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | static SEL cxx_construct = NULL; static SEL cxx_destruct = NULL; size_t of_pagesize; size_t of_num_cpus; #if !defined(OF_APPLE_RUNTIME) || defined(__OBJC2__) static void uncaught_exception_handler(id exception) { fprintf(stderr, "\nRuntime error: Unhandled exception:\n%s\n", [[exception description] UTF8String]); } |
︙ | ︙ | |||
232 233 234 235 236 237 238 | { _OFObject_Serialization_reference = 1; } @implementation OFObject + (void)load { | < < < < < < < < < < < < < | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | { _OFObject_Serialization_reference = 1; } @implementation OFObject + (void)load { #if !defined(OF_APPLE_RUNTIME) || defined(__OBJC2__) objc_setUncaughtExceptionHandler(uncaught_exception_handler); #endif #ifdef OF_OBJFW_RUNTIME objc_forward_handler = forward_handler; #endif |
︙ | ︙ |
Modified src/runtime/property.m from [677b6f2060] to [0d8c0c46ef].
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | * file. */ #include "config.h" #include <string.h> #import "OFObject.h" #import "macros.h" #ifdef OF_THREADS # import "threading.h" # define NUM_SPINLOCKS 8 /* needs to be a power of 2 */ # define SPINLOCK_HASH(p) ((unsigned)((uintptr_t)p >> 4) & (NUM_SPINLOCKS - 1)) static of_spinlock_t spinlocks[NUM_SPINLOCKS]; #endif | > > > | > | < < < | < > | 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 50 51 | * file. */ #include "config.h" #include <string.h> #import "runtime.h" #import "runtime-private.h" #import "OFObject.h" #import "macros.h" #ifdef OF_THREADS # import "threading.h" # define NUM_SPINLOCKS 8 /* needs to be a power of 2 */ # define SPINLOCK_HASH(p) ((unsigned)((uintptr_t)p >> 4) & (NUM_SPINLOCKS - 1)) static of_spinlock_t spinlocks[NUM_SPINLOCKS]; #endif #ifdef OF_THREADS static void __attribute__((constructor)) init(void) { size_t i; for (i = 0; i < NUM_SPINLOCKS; i++) if (!of_spinlock_new(&spinlocks[i])) OBJC_ERROR("Failed to initialize spinlocks!") } #endif id objc_getProperty(id self, SEL _cmd, ptrdiff_t offset, BOOL atomic) { if (atomic) { id *ptr = (id*)(void*)((char*)self + offset); #ifdef OF_THREADS |
︙ | ︙ |
Modified src/runtime/synchronized.m from [60cb02c7ef] to [9fc3b19498].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 | #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <sys/types.h> #import "runtime.h" #import "threading.h" struct lock_s { | > | | | | | < > | | > | 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 50 51 52 53 54 55 56 57 58 59 60 | #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <sys/types.h> #import "runtime.h" #import "runtime-private.h" #import "threading.h" struct lock_s { id object; size_t count; size_t recursion; of_thread_t thread; of_mutex_t mutex; }; static of_mutex_t mutex; static struct lock_s *locks = NULL; static ssize_t numLocks = 0; #define SYNC_ERR(f) \ { \ fprintf(stderr, "WARNING: %s failed in line %d!\n" \ "WARNING: This might result in a race " \ "condition!\n", f, __LINE__); \ return 1; \ } static void __attribute__((constructor)) init(void) { if (!of_mutex_new(&mutex)) OBJC_ERROR("Failed to create mutex!") } int objc_sync_enter(id object) { ssize_t i; |
︙ | ︙ |