Is there a way to determine if free()
would fail if ever called on a certain memory block pointer?
I have the following situation: a thread having access to a shared resource fails whilst it may have been in the state of freeing the said resource. Now I need to devise a safe way to clean-up this shared resource.
Of course I have assigned ownership of the resource for the normal case but what about the aforementioned limit case?
UPDATED: If I use additional synchronizing mechanisms it only makes more cleaning up to do and might involved additional limit conditions. I'd like to limit/avoid those if possible.
Resolution: I finally settled on performing re-factoring. Thanks to all contributors. You guys rock!