added cross-platform Mutex implementation; enable platform-native (GDC/Concurrency) parallel_for_ implementation when TBB is not installed.

This commit is contained in:
Vadim Pisarevsky
2012-08-17 17:32:06 +04:00
parent 2e685dcf0a
commit 41b6d25bdd
3 changed files with 138 additions and 0 deletions

View File

@@ -4620,6 +4620,34 @@ public:
CV_EXPORTS void parallel_for_(const Range& range, const ParallelLoopBody& body);
/////////////////////////// Synchronization Primitives ///////////////////////////////
class CV_EXPORTS Mutex
{
public:
Mutex();
~Mutex();
Mutex(const Mutex& m);
Mutex& operator = (const Mutex& m);
void lock();
bool trylock();
void unlock();
struct Impl;
protected:
Impl* impl;
};
class CV_EXPORTS AutoLock
{
public:
AutoLock(Mutex& m) : mutex(&m) { mutex->lock(); }
~AutoLock() { mutex->unlock(); }
protected:
Mutex* mutex;
};
}
#endif // __cplusplus