You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
719 B
34 lines
719 B
// |
|
// RecursiveLock.swift |
|
// Platform |
|
// |
|
// Created by Krunoslav Zaher on 12/18/16. |
|
// Copyright © 2016 Krunoslav Zaher. All rights reserved. |
|
// |
|
|
|
import class Foundation.NSRecursiveLock |
|
|
|
#if TRACE_RESOURCES |
|
class RecursiveLock: NSRecursiveLock { |
|
override init() { |
|
_ = Resources.incrementTotal() |
|
super.init() |
|
} |
|
|
|
override func lock() { |
|
super.lock() |
|
_ = Resources.incrementTotal() |
|
} |
|
|
|
override func unlock() { |
|
super.unlock() |
|
_ = Resources.decrementTotal() |
|
} |
|
|
|
deinit { |
|
_ = Resources.decrementTotal() |
|
} |
|
} |
|
#else |
|
typealias RecursiveLock = NSRecursiveLock |
|
#endif
|
|
|