Skip to content

Commit

Permalink
Merge pull request #33 from Electrode-iOS/core/sohil/GPMNETE-5095
Browse files Browse the repository at this point in the history
Update the deployment target to iOS 10
  • Loading branch information
Sohil authored Jun 5, 2019
2 parents 3d399c7 + 19949e9 commit 41708e9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 68 deletions.
6 changes: 3 additions & 3 deletions ELFoundation.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down
64 changes: 0 additions & 64 deletions ELFoundation/Utilities/Synchronization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,67 +39,3 @@ public func synchronized<T>(_ 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<T>(_ 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
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Both targets build the same product (`ELFoundation.framework`), thus linking the

* `exceptionFailure` - A replacement for assertionFailure, usable in tests.
* `synchronized<T>` - 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.
Expand Down

0 comments on commit 41708e9

Please sign in to comment.