Differences From Artifact [bf7ff24437]:
- File src/exceptions/OFException.m — part of check-in [494acfb3e0] at 2020-05-17 14:08:15 on branch trunk — Add support for non-Unicode Windows in all classes (user: js, size: 7581) [annotate] [blame] [check-ins using] [more...]
To Artifact [aa89efc62e]:
- File
src/exceptions/OFException.m
— part of check-in
[5b37fbeb82]
at
2020-12-20 21:26:08
on branch trunk
— Return error instead of using errno for threading
errno is problematic for Amiga libraries and is also not thread-safe on
some systems, even though it should. (user: js, size: 7593) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
71 72 73 74 75 76 77 | #endif #if !defined(HAVE_STRERROR_R) && defined(OF_HAVE_THREADS) static of_mutex_t mutex; OF_CONSTRUCTOR() { | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #endif #if !defined(HAVE_STRERROR_R) && defined(OF_HAVE_THREADS) static of_mutex_t mutex; OF_CONSTRUCTOR() { if (of_mutex_new(&mutex) != 0) @throw [OFInitializationFailedException exception]; } #endif OFString * of_strerror(int errNo) { |
︙ | ︙ | |||
185 186 187 188 189 190 191 | if (strerror_r(errNo, buffer, 256) != 0) return @"Unknown error (strerror_r failed)"; ret = [OFString stringWithCString: buffer encoding: [OFLocale encoding]]; #else # ifdef OF_HAVE_THREADS | | | | 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 | if (strerror_r(errNo, buffer, 256) != 0) return @"Unknown error (strerror_r failed)"; ret = [OFString stringWithCString: buffer encoding: [OFLocale encoding]]; #else # ifdef OF_HAVE_THREADS if (of_mutex_lock(&mutex) != 0) @throw [OFLockFailedException exception]; @try { # endif ret = [OFString stringWithCString: strerror(errNo) encoding: [OFLocale encoding]]; # ifdef OF_HAVE_THREADS } @finally { if (of_mutex_unlock(&mutex) != 0) @throw [OFUnlockFailedException exception]; } # endif #endif return ret; } |
︙ | ︙ |