Re: NSImage from bitmap - then delete bitmap
Re: NSImage from bitmap - then delete bitmap
- Subject: Re: NSImage from bitmap - then delete bitmap
- From: Trygve Inda <email@hidden>
- Date: Fri, 22 Jul 2016 06:09:34 -0700
- Thread-topic: NSImage from bitmap - then delete bitmap
>> This is how it works now, but we are running into a rare deadlock situation
>> where the main thread asks the worker thread to end (and waits until it does
>> so) while the worker thread is waiting for the image to be displayed.
>
> If the window has a imageRep property that is (atomic, copy) you shouldn’t run
> into a deadlock where the window tries to terminate the thread and it happens
> to be calling that method at the time. If you go with Roland’s suggestion, it
> doesn’t need to be copy, it can simply be strong. But make it atomic, as the
> property will need to be accessed from both the main and the worker threads
> and the rep must be in a viable state at both times.
Ultimately there needs to be more than one copy of the pixels because as
soon as the worker thread is done building the image, it hands it off to the
main thread to be displayed.
Currently it blocks until the main thread displays it, so only one set of
pixels is needed. But to prevent deadlock, the worker thread really needs to
just hand of a copy of the pixels, then erase the original pixels and start
a new image.
[bitmapImageRep copy] might be the best solution here.
T.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden