This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
hi,
i have some code that calls vxMapImagePatch (on a Buf received from tiovx grpah), passes the data pointer to multiple consumers in different threads, and then ultimately calls vxUnmapImagePatch (in a different thread than then one that called Map).
is it legal to call vxUnmapImagePatch in a different thread?
should vxMapImagePatch/Unmap be called by each thread that needs to read the data?
all data consumers are strictly read only.
Hello,
is it legal to call vxUnmapImagePatch in a different thread?
Yes, vxUnmapImagePatch is safe to call from another thread.
should vxMapImagePatch/Unmap be called by each thread that needs to read the data?
That's a good question. For one MapImage call, there should be a corresponding unMap call, whether that is in the same thread or not.
In your case, you have multiple consumers, so I think there is some choice in your usage here. Among your multiple consumers, you may designate one of these to handle the unMap once all other threads would have used the data referenced at that patch (may require analysis and/or signaling). An alternative would be to copy that patch for each consumer and let them unMap as soon as they complete, but this is probably inefficient use of memory resources.
Otherwise, TIOVX and the image-patch handling does not internally track data consumers, so some signaling at the app-level is necessary to decide when it is safe to unmap that data.
BR,
-Reese