     }
     
     private func _remoteWorkItem() -> DispatchWorkItem {
-        let semaphore = DispatchSemaphore(value: 0)
         return DispatchWorkItem(block: { [weak self] in
             guard let self = self, let workItem = self.workItem else { return }
             var downloadData: Data?
             var downloadImage: UIImage?
             var resultImage: UIImage?
             var resultError: Error?
+            self.semaphore = DispatchSemaphore(value: 0)
             self._progress(progress: Progress(totalUnitCount: 0))
             self.query = self.provider.send(
                 request: QImageRequest(url: self.url),

    }
    
    public func cancel() {
        if let workItem = self.workItem {
            workItem.cancel()
            self.workItem = nil

                } catch let error {
                    resultError = error
                }
            } else {
                print("CANCELED")
            }
            self._finish(workItem: workItem, image: resultImage, error: resultError)
        })
