mirror of
https://github.com/samsonjs/SJSAssetExportSession.git
synced 2026-03-25 08:45:50 +00:00
27 lines
476 B
Swift
27 lines
476 B
Swift
//
|
|
// SendableWrapper.swift
|
|
// SJSAssetExportSessionTests
|
|
//
|
|
// Created by Sami Samhuri on 2024-07-07.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
final class SendableWrapper<T>: @unchecked Sendable {
|
|
private var unsafeValue: T
|
|
|
|
private let lock = NSLock()
|
|
|
|
var value: T {
|
|
get {
|
|
lock.withLock { unsafeValue }
|
|
}
|
|
set {
|
|
lock.withLock { unsafeValue = newValue }
|
|
}
|
|
}
|
|
|
|
init(_ value: T) {
|
|
unsafeValue = value
|
|
}
|
|
}
|