What I'm still unclear of is how the run-time handles the collection of __block-storage objects. It uses some sort of reference counting on the Block objects, and the __block-storage objects are referenced by the Block, presumably. But how it manages to decrement the reference count, I'm not sure of. It might not do it at all, so that in order for a Block to remain valid outside of the scope it was defined in you have to use the API, i.e. Block_copy, etc.Well, there is a Block_release() function for that. And actually, wrt __block variables, it stores a reference (pointer) to the variable on stack until you do your first Block_copy, then (if that happens) it moves the __block variable to the heap, alongside the copied block. IOW the __block variable address may change between two runs of the same block, that's why __block is incompatible with static.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds