     init(starter: @escaping Starter) {
         self.starter = starter
 
-        self._isExecuting = UnsafeMutablePointer<Int32>.allocate(capacity: 1)
-        self._isExecuting.initialize(to: 0)
-
-        self._isFinished = UnsafeMutablePointer<Int32>.allocate(capacity: 1)
-        self._isFinished.initialize(to: 0)
-
-        self.isFinishCalled = UnsafeMutablePointer<Int32>.allocate(capacity: 1)
-        self.isFinishCalled.initialize(to: 0)
+        self.lock = .allocate(capacity: 1)
+        self.lock.initialize(to: os_unfair_lock())
 
         #if TRACK_ALLOCATIONS
         Allocations.increment("Operation")

    typealias Starter = @Sendable (_ finish: @Sendable @escaping () -> Void) -> Void
    private let starter: Starter

    deinit {
        self._isExecuting.deallocate()
        self._isFinished.deallocate()
        self.isFinishCalled.deallocate()

        #if TRACK_ALLOCATIONS
        Allocations.decrement("Operation")

import Foundation

final class Operation: Foundation.Operation {
    override var isExecuting: Bool {
        get {
            os_unfair_lock_lock(lock)
            defer { os_unfair_lock_unlock(lock) }
            return _isExecuting
        }
        set {
            os_unfair_lock_lock(lock)
            _isExecuting = newValue
            os_unfair_lock_unlock(lock)

            willChangeValue(forKey: "isExecuting")
            didChangeValue(forKey: "isExecuting")
        }
    }

    override var isFinished: Bool {
        get {
            os_unfair_lock_lock(lock)
            defer { os_unfair_lock_unlock(lock) }
            return _isFinished
        }
        set {
            os_unfair_lock_lock(lock)
            _isFinished = newValue
            os_unfair_lock_unlock(lock)

            willChangeValue(forKey: "isFinished")
            didChangeValue(forKey: "isFinished")
        }
