Overview
Comment: | Make retain/release atomic. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b4a992406614143853ab4c4ddd0269ba |
User & Date: | js on 2010-01-24 18:54:58 |
Other Links: | manifest | tags |
Context
2010-01-24
| ||
20:07 | Fix a missing return in objc_setProperty. check-in: 63c5c7d501 user: js tags: trunk | |
18:54 | Make retain/release atomic. check-in: b4a9924066 user: js tags: trunk | |
2010-01-23
| ||
11:25 | Make -[readLineWithEncoding:] compatible with \r\n linebreaks. check-in: 1421bc837b user: js tags: trunk | |
Changes
Modified configure.ac from [37277c7aeb] to [7d51f7e767].
︙ | ︙ | |||
168 169 170 171 172 173 174 175 176 177 178 179 180 181 | AC_SUBST(OFTHREAD_M, "OFThread.m") AC_SUBST(THREADING_H, "threading.h") AC_CHECK_FUNC(objc_sync_enter,, [ AC_SUBST(OBJC_SYNC_M, "objc_sync.m") AC_DEFINE(NEED_OBJC_SYNC_INIT, 1, [Whether objc_sync_init needs to be called])]) fi AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32") AC_MSG_CHECKING(for getaddrinfo) AC_TRY_COMPILE([ | > > > > | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | AC_SUBST(OFTHREAD_M, "OFThread.m") AC_SUBST(THREADING_H, "threading.h") AC_CHECK_FUNC(objc_sync_enter,, [ AC_SUBST(OBJC_SYNC_M, "objc_sync.m") AC_DEFINE(NEED_OBJC_SYNC_INIT, 1, [Whether objc_sync_init needs to be called])]) AC_CHECK_HEADER(libkern/OSAtomic.h, [ AC_DEFINE(OF_HAVE_LIBKERN_OSATOMIC_H, 1, [Whether we have libkern/OSAtomic.h])]) fi AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32") AC_MSG_CHECKING(for getaddrinfo) AC_TRY_COMPILE([ |
︙ | ︙ |
Modified src/Makefile from [cdf0569045] to [45d69f835a].
︙ | ︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 43 44 | unicode.m INCLUDES := ${SRCS:.m=.h} \ OFFastEnumeration.h \ OFMacros.h \ ObjFW.h \ asprintf.h \ objfw-defs.h \ ${THREADING_H} SRCS += ${AS_PRINTF_M} \ iso_8859_15.m \ windows_1252.m \ ${OBJC_PROPERTIES_M} \ | > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | unicode.m INCLUDES := ${SRCS:.m=.h} \ OFFastEnumeration.h \ OFMacros.h \ ObjFW.h \ asprintf.h \ atomic.h \ objfw-defs.h \ ${THREADING_H} SRCS += ${AS_PRINTF_M} \ iso_8859_15.m \ windows_1252.m \ ${OBJC_PROPERTIES_M} \ |
︙ | ︙ |
Modified src/OFObject.m from [844da0afa5] to [1a2c0cda4c].
︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #ifdef OF_APPLE_RUNTIME # import <objc/runtime.h> #endif #ifdef OF_GNU_RUNTIME # import <objc/sarray.h> #endif struct pre_ivar { void **memchunks; size_t memchunks_size; size_t retain_count; }; /* Hopefully no arch needs more than 16 bytes padding */ | > > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #ifdef OF_APPLE_RUNTIME # import <objc/runtime.h> #endif #ifdef OF_GNU_RUNTIME # import <objc/sarray.h> #endif #import "atomic.h" struct pre_ivar { void **memchunks; size_t memchunks_size; size_t retain_count; }; /* Hopefully no arch needs more than 16 bytes padding */ |
︙ | ︙ | |||
469 470 471 472 473 474 475 | @throw [OFMemoryNotPartOfObjectException newWithClass: isa pointer: ptr]; } - retain { | | | | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | @throw [OFMemoryNotPartOfObjectException newWithClass: isa pointer: ptr]; } - retain { of_atomic_inc32(&PRE_IVAR->retain_count); return self; } - (size_t)retainCount { return PRE_IVAR->retain_count; } - (void)release { if (!of_atomic_dec32(&PRE_IVAR->retain_count)) [self dealloc]; } - autorelease { [OFAutoreleasePool addObjectToTopmostPool: self]; |
︙ | ︙ |
Added src/atomic.h version [34bfd081ab].
> > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* * 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. */ #import "objfw-defs.h" #if !defined(OF_THREADS) # define of_atomic_inc32(p) ++(*p) # define of_atomic_dec32(p) --(*p) #elif __GNUC_MINOR__ >= 1 # define of_atomic_inc32(p) __sync_add_and_fetch(p, 1) # define of_atomic_dec32(p) __sync_sub_and_fetch(p, 1) #elif OF_HAVE_LIBKERN_OSATOMIC_H # include <libkern/OSAtomic.h> # define of_atomic_inc32(p) OSAtomicIncrement32Barrier((int32_t*)(p)) # define of_atomic_dec32(p) OSAtomicDecrement32Barrier((int32_t*)(p)) #else # error No atomic operations available! #endif |
Modified src/objfw-defs.h.in from [42800a53ae] to [a4810732ab].
1 2 3 4 5 6 7 | #undef OF_APPLE_RUNTIME #undef OF_BIG_ENDIAN #undef OF_GNU_RUNTIME #undef OF_HAVE_ASPRINTF #undef OF_PLUGINS #undef OF_THREADS #undef SIZE_MAX | > | 1 2 3 4 5 6 7 8 | #undef OF_APPLE_RUNTIME #undef OF_BIG_ENDIAN #undef OF_GNU_RUNTIME #undef OF_HAVE_ASPRINTF #undef OF_HAVE_LIBKERN_OSATOMIC_H #undef OF_PLUGINS #undef OF_THREADS #undef SIZE_MAX |