From 19949e9b0734b409ef080cb2bdc401842308dca9 Mon Sep 17 00:00:00 2001 From: Sohil Rupani Date: Tue, 28 May 2019 11:40:49 -0700 Subject: [PATCH] Update the deployment target to iOS 10 --- ELFoundation.xcodeproj/project.pbxproj | 6 +- ELFoundation/Utilities/Synchronization.swift | 64 -------------------- README.md | 1 - 3 files changed, 3 insertions(+), 68 deletions(-) diff --git a/ELFoundation.xcodeproj/project.pbxproj b/ELFoundation.xcodeproj/project.pbxproj index 84671b3..0902948 100644 --- a/ELFoundation.xcodeproj/project.pbxproj +++ b/ELFoundation.xcodeproj/project.pbxproj @@ -621,7 +621,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 10; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = NO; SDKROOT = iphoneos; @@ -875,7 +875,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 10; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -930,7 +930,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 10; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; diff --git a/ELFoundation/Utilities/Synchronization.swift b/ELFoundation/Utilities/Synchronization.swift index d00ac04..496c430 100644 --- a/ELFoundation/Utilities/Synchronization.swift +++ b/ELFoundation/Utilities/Synchronization.swift @@ -39,67 +39,3 @@ public func synchronized(_ lock: AnyObject, closure: () -> T) -> T { objc_sync_exit(lock) return result } - -/** - OS Level Spin Lock class. Wraps the OSSpinLock* functions to allow for - synchronization around a specified closure. This is very useful for properties - where get/set need to be thread-safe. -*/ -final public class Spinlock { - public init() { - - } - - /** - Tries to acquire the lock, and if successful executes the specified closure. - - - parameter closure: Closure to execute inside of the lock. - - returns: False if it failed to acquire the lock, otherwise true. - */ - public func tryaround(_ closure: () -> Void) -> Bool { - let held = OSSpinLockTry(&spinlock) - if !held { - closure() - OSSpinLockUnlock(&spinlock) - } - return held - } - - /** - Runs the specified closure within the spin lock. - - - parameter closure: Closure to execute inside of the lock. - */ - public func around(_ closure: () -> Void) { - OSSpinLockLock(&spinlock) - closure() - OSSpinLockUnlock(&spinlock) - } - - /** - Runs the specified closure within the spin lock, returning the type T. - - - parameter closure: Closure to execute inside of the lock. - - returns: The result of the closure. - */ - public func around(_ closure: () -> T) -> T { - OSSpinLockLock(&spinlock) - let result: T = closure() - OSSpinLockUnlock(&spinlock) - return result - } - - public func lock() { - OSSpinLockLock(&spinlock) - } - - public func trylock() -> Bool { - return OSSpinLockTry(&spinlock) - } - - public func unlock() { - OSSpinLockUnlock(&spinlock) - } - - fileprivate var spinlock: OSSpinLock = OS_SPINLOCK_INIT -} diff --git a/README.md b/README.md index cc9961e..59fe025 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,6 @@ Both targets build the same product (`ELFoundation.framework`), thus linking the * `exceptionFailure` - A replacement for assertionFailure, usable in tests. * `synchronized` - Akin to @synchronized() in Objective-C. -* `Spinlock` - A basic spinlock implementation for synchronization. * `Object Association` - Objective-C style object association. * `Swizzling` - Objective-C style swizzling. * `Array (extensions)` - Handy extensions.