1

I have a function that manipulates a UIImage

func myFunc(sourceImage: UIImage) {
    ...

    UIGraphicsBeginImageContextWithOptions(dstSize, true, 1)

    let ctx = UIGraphicsGetCurrentContext()!
    CGContextSetInterpolationQuality(ctx, CGInterpolationQuality.High)

    sourceImage.drawInRect(dstRect)

    let newImage = UIGraphicsGetImageFromCurrentImageContext()

    UIGraphicsEndImageContext()

    ...
}

Is this function thread-safe (multiple threads can process different images at the same time)?

From my understanding, functions like UIGraphicsGetCurrentContext returns the same object on every thread so it isn't

Code
  • 5,748
  • 3
  • 29
  • 70
  • also see http://stackoverflow.com/questions/2940215/uigraphicsgetcurrentcontext-threading-problem – Hamish Feb 04 '16 at 18:48

0 Answers0