Overview
Comment: | Make it possible to build ObjFW without support for threads. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
6caac0826e4fe3063ba8ca9b5b473c1e |
User & Date: | js on 2009-12-11 12:52:29 |
Other Links: | manifest | tags |
Context
2009-12-12
| ||
14:19 | Remove OBJC_SYNC variable as it is not used anymore. check-in: b7e505ba7f user: js tags: trunk | |
2009-12-11
| ||
12:52 | Make it possible to build ObjFW without support for threads. check-in: 6caac0826e user: js tags: trunk | |
2009-12-09
| ||
19:09 | Check whether getaddrinfo is thread-safe and use locks if not. check-in: c8398d985d user: js tags: trunk | |
Changes
Modified configure.ac from [e854e5bdb3] to [3eec75f7eb].
︙ | |||
75 76 77 78 79 80 81 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | - - - - - - | ], [ AC_MSG_RESULT(yes) size_max="SIZE_T_MAX"], [ AC_MSG_RESULT(no) size_max="((size_t)-1)"]) AC_DEFINE_UNQUOTED(SIZE_MAX, $size_max, [Maximum value for size_t])]) |
︙ | |||
108 109 110 111 112 113 114 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + | ac_cv_snprintf_useful_ret="no")]) AC_MSG_RESULT($ac_cv_snprintf_useful_ret)]) test x"$have_asprintf" != x"yes" -a x"$ac_cv_snprintf_useful_ret" != x"yes" && \ AC_MSG_ERROR(No asprintf and no snprintf returning required space!) AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl") AC_ARG_ENABLE(threads, AS_HELP_STRING([--disable-threads], [disable thread support])) if test x"$enable_threads" != x"no"; then |
︙ | |||
142 143 144 145 146 147 148 | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + | #endif], [ struct addrinfo ai; getaddrinfo(NULL, NULL, NULL, NULL); ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether we have getaddrinfo]) if test x"$enable_threads" != x"no"; then |
︙ |
Modified extra.mk.in from [f5c4908cf0] to [6f868ad29d].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 | + + | ASPRINTF_M = @ASPRINTF_M@ OBJC_SYNC = @OBJC_SYNC@ OBJC_SYNC_M = @OBJC_SYNC_M@ OFPLUGIN_M = @OFPLUGIN_M@ OFTHREAD_M = @OFTHREAD_M@ TESTPLUGIN = @TESTPLUGIN@ WS2_LIBS = @WS2_LIBS@ TESTS = @TESTS@ TEST_LAUNCHER = @TEST_LAUNCHER@ THREADING_H = @THREADING_H@ |
Modified src/Makefile from [a627df95af] to [4c19f6132f].
︙ | |||
20 21 22 23 24 25 26 | 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 | - + - + | OFNumber.m \ OFObject.m \ ${OFPLUGIN_M} \ OFSocket.m \ OFStream.m \ OFString.m \ OFTCPSocket.m \ |
Modified src/OFAutoreleasePool.m from [3ea4e1ab45] to [929d90108c].
︙ | |||
11 12 13 14 15 16 17 | 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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 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 119 120 121 122 123 | - + + + + + + + + + + + + + + + + + + + + + + + + + | #include "config.h" #include <stdlib.h> #import "OFAutoreleasePool.h" #import "OFList.h" |
︙ | |||
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | + + + + + + + + + | * If of_tlskey_set fails, this is a real problem. The best we can do * is to not change the pool below the current pool and stop * deallocation. This way, new objects will be added to the current * pool, but released when the pool below gets released - and maybe * the pool itself will be released as well then, because maybe * of_tlskey_set will work this time. */ #ifdef OF_THREADS if (!of_tlskey_set(last_key, prev)) return; #else last = prev; #endif if (prev != nil) prev->next = nil; /* * If of_tlskey_set fails here, this is even worse, as this will * definitely be a memory leak. But this should never happen anyway. */ #ifdef OF_THREADS if (of_tlskey_get(first_key) == self) if (!of_tlskey_set(first_key, nil)) return; #else if (first == self) first = nil; #endif [super dealloc]; } - addObject: (OFObject*)obj { if (objects == nil) |
︙ |
Modified src/OFTCPSocket.m from [f13b976cd7] to [a4d491ccd6].
︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 | 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 | + - + - + | # ifndef _WIN32 # include <arpa/inet.h> # endif #endif #import "OFTCPSocket.h" #import "OFExceptions.h" #import "OFMacros.h" #ifndef INVALID_SOCKET #define INVALID_SOCKET -1 #endif |
︙ | |||
65 66 67 68 69 70 71 | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | - + - + | #ifdef HAVE_GETADDRINFO struct addrinfo hints, *res, *res0; memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; |
︙ | |||
95 96 97 98 99 100 101 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | - + + + + + + + + + + + | } break; } freeaddrinfo(res0); |
︙ | |||
185 186 187 188 189 190 191 | 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 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | + + + + - + + + + + + + + + + + + + + + + + + + + + + | #ifdef HAVE_GETADDRINFO struct addrinfo hints, *res; memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; #if defined(OF_THREADS) && !defined(HAVE_THREADSAFE_GETADDRINFO) [mutex lock]; #endif |
︙ |
Modified src/ObjFW.h from [02c23721b3] to [37f9619c34].
︙ | |||
29 30 31 32 33 34 35 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - + + + + | #import "OFFile.h" #import "OFSocket.h" #import "OFTCPSocket.h" #import "OFHashes.h" |
Modified src/objfw-defs.h.in from [b3fd317650] to [42800a53ae].
1 2 3 4 5 6 | 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 |
Modified tests/Makefile from [57486b04f8] to [686ed1967d].
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + | OFDictionary.m \ OFHashes.m \ OFList.m \ OFObject.m \ ${OFPLUGIN_M} \ OFString.m \ OFTCPSocket.m \ |
︙ |
Modified tests/main.m from [513215acfc] to [7efaf05c3f].
︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | + + | extern void list_tests(); extern void object_tests(); #ifdef OF_PLUGINS extern void plugin_tests(); #endif extern void string_tests(); extern void tcpsocket_tests(); #ifdef OF_THREADS extern void thread_tests(); #endif extern void xmlelement_tests(); extern void xmlparser_tests(); static int fails = 0; static void output(OFString *str, int color) |
︙ | |||
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | + + | hashes_tests(); string_tests(); dataarray_tests(); array_tests(); dictionary_tests(); list_tests(); tcpsocket_tests(); #ifdef OF_THREADS thread_tests(); #endif xmlelement_tests(); xmlparser_tests(); #ifdef OF_PLUGINS plugin_tests(); #endif return fails; } |