mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #8204 from terfendail:ovx_tlcontext
This commit is contained in:
@@ -20,6 +20,12 @@
|
||||
#define IVX_USE_OPENCV
|
||||
#include "ivx.hpp"
|
||||
|
||||
namespace cv{
|
||||
namespace ovx{
|
||||
// Get common thread local OpenVX context
|
||||
CV_EXPORTS_W ivx::Context& getOpenVXContext();
|
||||
}}
|
||||
|
||||
#define CV_OVX_RUN(condition, func, ...) \
|
||||
if (cv::useOpenVX() && (condition) && func) \
|
||||
{ \
|
||||
|
||||
@@ -627,6 +627,9 @@ public:
|
||||
virtual void deleteDataInstance(void* pData) const = 0;
|
||||
|
||||
int key_;
|
||||
|
||||
public:
|
||||
void cleanup(); //! Release created TLS data container objects. It is similar to release() call, but it keeps TLS container valid.
|
||||
};
|
||||
|
||||
// Main TLS data class
|
||||
@@ -638,13 +641,15 @@ public:
|
||||
inline ~TLSData() { release(); } // Release key and delete associated data
|
||||
inline T* get() const { return (T*)getData(); } // Get data associated with key
|
||||
|
||||
// Get data from all threads
|
||||
// Get data from all threads
|
||||
inline void gather(std::vector<T*> &data) const
|
||||
{
|
||||
std::vector<void*> &dataVoid = reinterpret_cast<std::vector<void*>&>(data);
|
||||
gatherData(dataVoid);
|
||||
}
|
||||
|
||||
inline void cleanup() { TLSDataContainer::cleanup(); }
|
||||
|
||||
private:
|
||||
virtual void* createDataInstance() const {return new T;} // Wrapper to allocate data by template
|
||||
virtual void deleteDataInstance(void* pData) const {delete (T*)pData;} // Wrapper to release data by template
|
||||
|
||||
Reference in New Issue
Block a user