Differences From Artifact [8256799039]:
- File src/OFMutex.m — part of check-in [374e1a1bfa] at 2021-01-02 22:04:26 on branch trunk — Update copyright (user: js, size: 2045) [annotate] [blame] [check-ins using] [more...]
To Artifact [beea68f36f]:
- File
src/OFMutex.m
— part of check-in
[dfd52d5220]
at
2021-04-17 16:24:13
on branch new-naming-convention
— of_mutex_t -> OFPlainMutex
Also rename of_rmutex_t -> OFPlainRecursiveMutex. (user: js, size: 2060) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
33 34 35 36 37 38 39 | return [[[self alloc] init] autorelease]; } - (instancetype)init { self = [super init]; | | | | | | | 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 | return [[[self alloc] init] autorelease]; } - (instancetype)init { self = [super init]; if (OFPlainMutexNew(&_mutex) != 0) { Class c = self.class; [self release]; @throw [OFInitializationFailedException exceptionWithClass: c]; } _initialized = true; return self; } - (void)dealloc { if (_initialized) { int error = OFPlainMutexFree(&_mutex); if (error != 0) { OF_ENSURE(error == EBUSY); @throw [OFStillLockedException exceptionWithLock: self]; } } [_name release]; [super dealloc]; } - (void)lock { int error = OFPlainMutexLock(&_mutex); if (error != 0) @throw [OFLockFailedException exceptionWithLock: self errNo: error]; } - (bool)tryLock { int error = OFPlainMutexTryLock(&_mutex); if (error != 0) { if (error == EBUSY) return false; else @throw [OFLockFailedException exceptionWithLock: self errNo: error]; } return true; } - (void)unlock { int error = OFPlainMutexUnlock(&_mutex); if (error != 0) @throw [OFUnlockFailedException exceptionWithLock: self errNo: error]; } - (OFString *)description |
︙ | ︙ |