Differences From Artifact [5a3f2982c0]:
- File
src/OFThread.m
— part of check-in
[e7f4f80e23]
at
2020-01-24 03:03:32
on branch trunk
— runtime: Correctly handle AR pool push during pop
Getting a pointer and increasing it until we reach the top pointer does
not work: Releasing an object can temporarily create new autorelease
pools, which can trigger resizing of "objects" using realloc, which can
move it to a different address, which will then lead to continuing to
iterate on a now invalid pointer.This is now solved by using an index into "objects" instead. Since we're
now indexing for the pop, let's use indexes everywhere, as they're more
readable anyway.While debugging this, I noticed that the last pool is popped quite
frequently, only for a new pool to be pushed immediately again. This
resulted in a free followed by a malloc every time. Instead, keep the
pool, but let OFThread explicitly say when to free everything. (user: js, size: 10770) [annotate] [blame] [check-ins using] [more...]
To Artifact [690c42ccaa]:
- File
src/OFThread.m
— part of check-in
[9e9ce6aa1c]
at
2020-09-27 03:08:51
on branch trunk
— Work around bugs in Apple GCC 4.0.1
Still miscompiles things. (user: js, size: 10780) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
252 253 254 255 256 257 258 | @throw [OFOutOfRangeException exception]; svcSleepThread((int64_t)(timeInterval * 1000000000)); #elif defined(HAVE_NANOSLEEP) struct timespec rqtp; rqtp.tv_sec = (time_t)timeInterval; | | | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | @throw [OFOutOfRangeException exception]; svcSleepThread((int64_t)(timeInterval * 1000000000)); #elif defined(HAVE_NANOSLEEP) struct timespec rqtp; rqtp.tv_sec = (time_t)timeInterval; rqtp.tv_nsec = (long)((timeInterval - rqtp.tv_sec) * 1000000000); if (rqtp.tv_sec != trunc(timeInterval)) @throw [OFOutOfRangeException exception]; nanosleep(&rqtp, NULL); #elif defined(OF_AMIGAOS) if (timeInterval * 50 > ULONG_MAX) |
︙ | ︙ | |||
332 333 334 335 336 337 338 | { [OFThread currentThread].name = name; if (name != nil) of_thread_set_name( [name cStringWithEncoding: [OFLocale encoding]]); else | | | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | { [OFThread currentThread].name = name; if (name != nil) of_thread_set_name( [name cStringWithEncoding: [OFLocale encoding]]); else of_thread_set_name(class_getName([self class])); } + (OFString *)name { return [OFThread currentThread].name; } |
︙ | ︙ |