2017-07-26 16:52:15 +02:00
|
|
|
//
|
|
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
/**
|
|
|
|
* We synchronize access to state in this class using this queue.
|
|
|
|
*/
|
2017-12-01 16:48:18 +01:00
|
|
|
public func assertOnQueue(_ queue: DispatchQueue) {
|
2017-07-26 16:52:15 +02:00
|
|
|
if #available(iOS 10.0, *) {
|
|
|
|
dispatchPrecondition(condition: .onQueue(queue))
|
|
|
|
} else {
|
|
|
|
// Skipping check on <iOS10, since syntax is different and it's just a development convenience.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-01 16:48:18 +01:00
|
|
|
public func owsFail(_ message: String) {
|
2017-07-26 16:52:15 +02:00
|
|
|
Logger.error(message)
|
|
|
|
Logger.flush()
|
|
|
|
assertionFailure(message)
|
|
|
|
}
|