Revision: 28421 http://sourceforge.net/p/bibdesk/svn/28421 Author: hofman Date: 2023-11-05 16:34:16 +0000 (Sun, 05 Nov 2023) Log Message: ----------- Use OSAtomic or stdatomic depending on deployment target. Header with macros to get the right atomic operations.
Modified Paths: -------------- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVConcreteOperationQueue.h trunk/bibdesk_vendorsrc/amaxwell/FileView/FVConcreteOperationQueue.m trunk/bibdesk_vendorsrc/amaxwell/FileView/FVImageBuffer.m trunk/bibdesk_vendorsrc/amaxwell/FileView/FVOperation.m trunk/bibdesk_vendorsrc/amaxwell/FileView/FVThread.m trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.xcodeproj/project.pbxproj trunk/bibdesk_vendorsrc/amaxwell/FileView/_FVMappedDataProvider.m Added Paths: ----------- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAtomic.h Added: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAtomic.h =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAtomic.h (rev 0) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAtomic.h 2023-11-05 16:34:16 UTC (rev 28421) @@ -0,0 +1,102 @@ +// +// FVAtomic.h +// FileView +// +// Created by Christiaan Hofmanon 05/11/2023. +/* + This software is Copyright (c) 2023 + Christiaan Hofman. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Christiaan Hofman nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#if defined(MAC_OS_X_VERSION_10_12) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12 + +#import <stdatomic.h> + +#define FVAtomic(_type) _Atomic(_type) +#define FVAtomic64(_type) _Atomic(_type) + +#define FVAtomicLoad(_var) atomic_load(&_var) + +#define FVAtomicAdd(_var, _amount) atomic_fetch_add(&_var, _amount) +#define FVAtomicAdd64(_var, _amount) atomic_fetch_add(&_var, _amount) +#define FVAtomicSub(_var, _amount) atomic_fetch_sub(&_var, _amount) +#define FVAtomicSub64(_var, _amount) atomic_fetch_sub(&_var, _amount) + +#define FVAtomicStore(_var, _value) atomic_store(&_var, _value) + +#define FVAtomicSet(_var) atomic_store(&_var, YES) +#define FVAtomicUnset(_var) atomic_store(&_var, NO) + +#define FVAtomicInc(_var) atomic_store(&_var, 1) +#define FVAtomicDec(_var) atomic_store(&_var, 1) + +#else + +#import <libkern/OSAtomic.h> + +#define FVAtomic(_type) volatile int32_t +#define FVAtomic64(_type) volatile uint64_t + +#define FVAtomicLoad(_var) _var + +#define FVAtomicAdd(_var, _amount) bool swap; \ +do { \ + swap = OSAtomicCompareAndSwap32Barrier(_var, _var + _amount, &_var); \ +} while (false == swap) + +#define FVAtomicAdd64(_var, _amount) bool swap; \ +do { \ + swap = OSAtomicCompareAndSwap64Barrier(_var, _var + _amount, (int64_t *)&_var); \ +} while (false == swap) + +#define FVAtomicSub(_var, _amount) bool swap; \ +do { \ + swap = OSAtomicCompareAndSwap32Barrier(_var, _var - _amount, &_var); \ +} while (false == swap) + +#define FVAtomicSub64(_var, _amount) bool swap; \ +do { \ + swap = OSAtomicCompareAndSwap64Barrier(_var, _var - _amount, (int64_t *)&_var); \ +} while (false == swap) + +#define FVAtomicStore(_var, _value) bool swap; \ +do { \ + swap = OSAtomicCompareAndSwap32Barrier(_var, _value, &_var); \ +} while (false == swap) + +#define FVAtomicSet(_var) OSAtomicCompareAndSwap32Barrier(0, 1, &_var) +#define FVAtomicUnset(_var) OSAtomicCompareAndSwap32Barrier(1, 0, &_var) + +#define FVAtomicInc(_var) OSAtomicIncrement32Barrier(&_var) +#define FVAtomicDec(_var) OSAtomicDecrement32Barrier(&_var) + +#endif + Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVConcreteOperationQueue.h =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVConcreteOperationQueue.h 2023-11-04 17:52:29 UTC (rev 28420) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVConcreteOperationQueue.h 2023-11-05 16:34:16 UTC (rev 28421) @@ -40,7 +40,7 @@ #import "FVOperationQueue.h" #import <pthread.h> #import <mach/port.h> -#import <stdatomic.h> +#import "FVAtomic.h" @class FVOperation, FVPriorityQueue; @@ -50,7 +50,7 @@ @interface FVConcreteOperationQueue : FVOperationQueue { @private - _Atomic(BOOL) _terminate; + FVAtomic(BOOL) _terminate; mach_port_t _threadPort; NSConditionLock *_threadLock; pthread_mutex_t _queueLock; Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVConcreteOperationQueue.m =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVConcreteOperationQueue.m 2023-11-04 17:52:29 UTC (rev 28420) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVConcreteOperationQueue.m 2023-11-05 16:34:16 UTC (rev 28421) @@ -63,15 +63,15 @@ // Threading parameters. 20 seems high, but I tried using NSOperationQueue and ended up spawning 70+ threads with no problems. Most of them just block while waiting for ATS font data (at least in the PDF case), but we could end up with some disk thrash while reading (need to check this). A recommendation by Chris Kane http://www.cocoabuilder.com/archive/message/cocoa/2008/2/1/197773 indicates that dumping all the operations in the queue and letting the kernel sort out resource allocation is a reasonable approach, since we don't know a prioi which operations will be fast or slow. -static _Atomic(int32_t) _activeQueueCount = 0; -static _Atomic(int32_t) _activeCPUs = 0; +static FVAtomic(int32_t) _activeQueueCount = 0; +static FVAtomic(int32_t) _activeCPUs = 0; // Allow a maximum of 10 operations per active CPU core and a minimum of 2 per core; untuned. Main idea here is to keep from killing performance by creating too many threads or operations, but memory/disk are also big factors that are unaccounted for here. + (NSUInteger)_availableOperationCount { - int32_t maxConcurrentOperations = atomic_load(&_activeCPUs) * 10; + int32_t maxConcurrentOperations = FVAtomicLoad(_activeCPUs) * 10; int32_t minConcurrentOperations = 2; - return MAX((maxConcurrentOperations - ((atomic_load(&_activeQueueCount) - 1) * minConcurrentOperations)), minConcurrentOperations); + return MAX((maxConcurrentOperations - ((FVAtomicLoad(_activeQueueCount) - 1) * minConcurrentOperations)), minConcurrentOperations); } + (void)_updateKernelInfo:(id)unused @@ -87,7 +87,7 @@ if (sysctlbyname("hw.activecpu", &activeCPUs, &size, NULL, 0) == 0) numberOfCPUs = activeCPUs; } - atomic_store(&_activeCPUs, numberOfCPUs); + FVAtomicStore(_activeCPUs, numberOfCPUs); } + (void)initialize @@ -129,7 +129,7 @@ [_threadLock lockWhenCondition:QUEUE_STARTUP_COMPLETE]; [_threadLock unlockWithCondition:QUEUE_RUNNING]; - atomic_fetch_add(&_activeQueueCount, 1); + FVAtomicInc(_activeQueueCount); } return self; @@ -137,7 +137,7 @@ - (void)dealloc { - FVAPIAssert1(YES == atomic_load(&_terminate), @"*** ERROR *** attempt to deallocate %@ without calling -terminate", self); + FVAPIAssert1(YES == FVAtomicLoad(_terminate), @"*** ERROR *** attempt to deallocate %@ without calling -terminate", self); [_threadLock release]; [_pendingOperations release]; [_activeOperations release]; @@ -199,7 +199,7 @@ ret = __FVSendTrivialMachMessage(_threadPort, 0, MACH_SEND_TIMEOUT, 0); if (ret != MACH_MSG_SUCCESS && ret != MACH_SEND_TIMED_OUT) { // we can ignore MACH_SEND_INVALID_DEST when terminating - if (MACH_SEND_INVALID_DEST != ret || YES != atomic_load(&_terminate)) HALT; + if (MACH_SEND_INVALID_DEST != ret || YES != FVAtomicLoad(_terminate)) HALT; } } @@ -252,10 +252,10 @@ - (void)terminate { - atomic_fetch_sub(&_activeQueueCount, 1); + FVAtomicDec(_activeQueueCount); [[NSNotificationCenter defaultCenter] removeObserver:self]; [self cancel]; - atomic_store(&_terminate, YES); + FVAtomicSet(_terminate); [self _wakeThread]; [_threadLock lockWhenCondition:QUEUE_TERMINATED]; [_threadLock unlock]; @@ -333,9 +333,9 @@ // timeout is only here in case the mach port dies SInt32 result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 10, TRUE); if (kCFRunLoopRunFinished == result || kCFRunLoopRunStopped == result) - atomic_store(&_terminate, YES); + FVAtomicSet(_terminate); - } while (NO == atomic_load(&_terminate)); + } while (NO == FVAtomicLoad(_terminate)); CFRunLoopSourceInvalidate(source); CFRelease(source); Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVImageBuffer.m =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVImageBuffer.m 2023-11-04 17:52:29 UTC (rev 28420) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVImageBuffer.m 2023-11-05 16:34:16 UTC (rev 28421) @@ -39,14 +39,14 @@ #import "FVImageBuffer.h" #import "FVUtilities.h" #import "FVCGImageUtilities.h" -#import <stdatomic.h> +#import "FVAtomic.h" #import "FVBitmapContext.h" #import "FVAllocator.h" #if __LP64__ -static _Atomic(uint64_t) _allocatedBytes = 0; +static FVAtomic64(uint64_t) _allocatedBytes = 0; #else -static _Atomic(uint32_t) _allocatedBytes = 0; +static FVAtomic(uint32_t) _allocatedBytes = 0; #endif @implementation FVImageBuffer @@ -53,7 +53,7 @@ + (uint64_t)allocatedBytes { - return atomic_load(&_allocatedBytes); + return FVAtomicLoad(_allocatedBytes); } - (id)init @@ -78,7 +78,11 @@ buffer->rowBytes = bufferSize; _bufferSize = bufferSize; buffer->data = CFAllocatorAllocate([self allocator], bufferSize, 0); - atomic_fetch_add(&_allocatedBytes, _bufferSize); +#if __LP64__ + FVAtomicAdd64(_allocatedBytes, _bufferSize); +#else + FVAtomicAdd(_allocatedBytes, _bufferSize); +#endif if (NULL == buffer->data) { [self release]; self = nil; @@ -120,7 +124,11 @@ - (void)dealloc { if (_freeBufferOnDealloc) CFAllocatorDeallocate([self allocator], buffer->data); - atomic_fetch_sub(&_allocatedBytes, _bufferSize); +#if __LP64__ + FVAtomicSub64(_allocatedBytes, _bufferSize); +#else + FVAtomicSub(_allocatedBytes, _bufferSize); +#endif if (buffer != NULL) NSZoneFree([self zone], buffer); [super dealloc]; } Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVOperation.m =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVOperation.m 2023-11-04 17:52:29 UTC (rev 28420) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVOperation.m 2023-11-05 16:34:16 UTC (rev 28421) @@ -39,14 +39,14 @@ #import "FVOperation.h" #import "FVOperationQueue.h" #import "FVThread.h" -#import <stdatomic.h> +#import "FVAtomic.h" struct FVOpFlags { - _Atomic(BOOL) _cancelled; - _Atomic(FVOperationQueuePriority) _priority; - _Atomic(BOOL) _executing; - _Atomic(BOOL) _finished; - _Atomic(BOOL) _concurrent; + FVAtomic(BOOL) _cancelled; + FVAtomic(FVOperationQueuePriority) _priority; + FVAtomic(BOOL) _executing; + FVAtomic(BOOL) _finished; + FVAtomic(BOOL) _concurrent; }; @implementation FVOperation @@ -88,28 +88,28 @@ } - (FVOperationQueuePriority)queuePriority { - return atomic_load(&(_flags->_priority)); + return FVAtomicLoad(_flags->_priority); }; - (void)setQueuePriority:(FVOperationQueuePriority)queuePriority { - atomic_store(&(_flags->_priority), queuePriority); + FVAtomicStore(_flags->_priority, queuePriority); }; - (void)cancel { // allow multiple calls to -cancel - atomic_store(&(_flags->_cancelled), YES); + FVAtomicSet(_flags->_cancelled); }; - (BOOL)isCancelled { - return atomic_load(&(_flags->_cancelled)); + return FVAtomicLoad(_flags->_cancelled); }; - (BOOL)isExecuting { - return atomic_load(&(_flags->_executing)); + return FVAtomicLoad(_flags->_executing); }; - (BOOL)isFinished { - return atomic_load(&(_flags->_finished)); + return FVAtomicLoad(_flags->_finished); }; - (void)main { [self doesNotRecognizeSelector:_cmd]; } @@ -125,7 +125,7 @@ }; - (BOOL)isConcurrent { - return atomic_load(&(_flags->_concurrent)); + return FVAtomicLoad(_flags->_concurrent); } - (void)setConcurrent:(BOOL)flag { @@ -134,7 +134,10 @@ if ([self isExecuting] || [self isFinished]) [NSException raise:NSInternalInconsistencyException format:@"attempt to modify a previously executed operation"]; - atomic_store(&(_flags->_concurrent), flag); + if (flag) + FVAtomicSet(_flags->_concurrent); + else + FVAtomicUnset(_flags->_concurrent); } // semantics here as the same as for NSDate, if we consider the dates as absolute time values @@ -154,7 +157,7 @@ if ([self isExecuting] || [self isFinished]) [NSException raise:NSInternalInconsistencyException format:@"attempt to start a previously executed operation"]; - atomic_store(&(_flags->_executing), YES); + FVAtomicSet(_flags->_executing); if ([self isConcurrent]) [FVThread detachNewThreadSelector:@selector(main) toTarget:self withObject:nil]; @@ -166,7 +169,7 @@ { // Make sure the queue releases its reference to this operation. This always happens if it's cancelled by the queue, but someone else could call -cancel, in which case this might be left in the queue's activeOperations bag. [[self queue] finishedOperation:self]; - atomic_store(&(_flags->_finished), YES); + FVAtomicSet(_flags->_finished); } @end Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVThread.m =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVThread.m 2023-11-04 17:52:29 UTC (rev 28420) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVThread.m 2023-11-05 16:34:16 UTC (rev 28421) @@ -38,7 +38,7 @@ #import "FVThread.h" #import "FVUtilities.h" -#import <stdatomic.h> +#import "FVAtomic.h" #import <pthread.h> // lifted from CFInternal.h @@ -88,10 +88,10 @@ #define THREAD_POOL_MAX 60 #define THREAD_POOL_MIN 0 -static NSMutableArray *_threadPool = nil; -static pthread_mutex_t _lock = PTHREAD_MUTEX_INITIALIZER; -static NSInteger _threadPoolCapacity = THREAD_POOL_MAX; -static _Atomic(NSInteger) _threadCount = 0; +static NSMutableArray *_threadPool = nil; +static pthread_mutex_t _lock = PTHREAD_MUTEX_INITIALIZER; +static NSInteger _threadPoolCapacity = THREAD_POOL_MAX; +static FVAtomic(int32_t) _threadCount = 0; #define DEBUG_REAPER 0 @@ -136,7 +136,7 @@ pthread_mutex_unlock(&_lock); if (nil == thread) { thread = [_FVThread new]; - atomic_fetch_add(&_threadCount, 1); + FVAtomicInc(_threadCount); } return [thread autorelease]; } @@ -155,7 +155,7 @@ + (void)reapThreads { // !!! early return; recall that _threadCount != [_threadPool count] if threads are working - if (atomic_load(&_threadCount) <= THREAD_POOL_MIN) + if (FVAtomicLoad(_threadCount) <= THREAD_POOL_MIN) return; pthread_mutex_lock(&_lock); @@ -163,12 +163,12 @@ #if DEBUG_REAPER FVLog(@"%d threads should fear the reaper", cnt); #endif - while (cnt-- && atomic_load(&_threadCount) > THREAD_POOL_MIN) { + while (cnt-- && FVAtomicLoad(_threadCount) > THREAD_POOL_MIN) { _FVThread *thread = [_threadPool objectAtIndex:cnt]; if (CFAbsoluteTimeGetCurrent() - [thread lastPerformTime] > TIME_TO_DIE) { [thread die]; [_threadPool removeObjectAtIndex:cnt]; - atomic_fetch_sub(&_threadCount, 1); + FVAtomicDec(_threadCount); } } #if DEBUG_REAPER @@ -179,7 +179,7 @@ + (void)detachNewThreadSelector:(SEL)selector toTarget:(id)target withObject:(id)argument; { - if (_threadPoolCapacity == atomic_load(&_threadCount)) + if (_threadPoolCapacity == FVAtomicLoad(_threadCount)) [NSThread detachNewThreadSelector:selector toTarget:target withObject:argument]; else [[self thread] performSelector:selector withTarget:target argument:argument]; Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.xcodeproj/project.pbxproj =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.xcodeproj/project.pbxproj 2023-11-04 17:52:29 UTC (rev 28420) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.xcodeproj/project.pbxproj 2023-11-05 16:34:16 UTC (rev 28421) @@ -203,6 +203,7 @@ CEAD5FAC25B3A417002281E0 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; CEAD5FAF25B3A504002281E0 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; CEC9932C1072B6C50089F20D /* FVPreviewer.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FVPreviewer.xib; sourceTree = "<group>"; }; + CEDC2E092AF7EA7B0014D7A3 /* FVAtomic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FVAtomic.h; sourceTree = "<group>"; }; CEFC19B00F693E8B00B2AEE6 /* FileView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileView.h; sourceTree = "<group>"; }; CEFC1CEF0F6AB84000B2AEE6 /* FVCacheFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FVCacheFile.h; sourceTree = "<group>"; }; CEFC1CF00F6AB84000B2AEE6 /* FVCacheFile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FVCacheFile.mm; sourceTree = "<group>"; }; @@ -577,6 +578,7 @@ CEFC1D140F6AB94F00B2AEE6 /* FVAllocator.m */, CEFC1D150F6AB94F00B2AEE6 /* fv_zone.h */, CEFC1D160F6AB94F00B2AEE6 /* fv_zone.cpp */, + CEDC2E092AF7EA7B0014D7A3 /* FVAtomic.h */, ); name = Utilities; sourceTree = "<group>"; Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/_FVMappedDataProvider.m =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/_FVMappedDataProvider.m 2023-11-04 17:52:29 UTC (rev 28420) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/_FVMappedDataProvider.m 2023-11-05 16:34:16 UTC (rev 28421) @@ -41,7 +41,7 @@ #import <pthread.h> #import <sys/mman.h> #import <sys/stat.h> -#import <stdatomic.h> +#import "FVAtomic.h" typedef struct _FVMappedRegion { NSZone *zone; @@ -50,7 +50,7 @@ off_t length; } FVMappedRegion; -static _Atomic(off_t) _mappedDataSizeKB = 0; +static FVAtomic(off_t) _mappedDataSizeKB = 0; #define MAX_MAPPED_SIZE_KB 400000 // This is intentionally low, since I don't know what the limit is, and sysctl doesn't say. The max number of file descriptors is ~255 per process, but I can actually mmap ~28,000 files on 10.5.4. We should never see even this many in practice, though. @@ -81,7 +81,7 @@ + (BOOL)maxSizeExceeded { - return atomic_load(&_mappedDataSizeKB) > MAX_MAPPED_SIZE_KB || CFDictionaryGetCount(_dataProviders) >= MAX_MAPPED_PROVIDER_COUNT; + return FVAtomicLoad(_mappedDataSizeKB) > MAX_MAPPED_SIZE_KB || CFDictionaryGetCount(_dataProviders) >= MAX_MAPPED_PROVIDER_COUNT; } + (unsigned char)maxProviderCount; @@ -124,7 +124,7 @@ mapInfo->mapregion = NULL; } else { - atomic_fetch_add(&_mappedDataSizeKB, (mapInfo->length) / 1024); + FVAtomicAdd(_mappedDataSizeKB, (mapInfo->length) / 1024); } pInfo->_provider = CGDataProviderCreateDirect(mapInfo, mapInfo->length, &_FVMappedDataProviderDirectCallBacks); } @@ -169,7 +169,7 @@ FVMappedRegion *mapInfo = info; NSZoneFree(mapInfo->zone, mapInfo->path); if (mapInfo->mapregion) munmap(mapInfo->mapregion, mapInfo->length); - atomic_fetch_sub(&_mappedDataSizeKB, (mapInfo->length) / 1024); + FVAtomicSub(_mappedDataSizeKB, (mapInfo->length) / 1024); NSZoneFree(mapInfo->zone, info); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit