Fix Android build after commit:41b6d25
This commit is contained in:
parent
9d6ccecfdd
commit
ff3aa6cbe1
@ -939,11 +939,11 @@ struct Mutex::Impl
|
|||||||
{
|
{
|
||||||
Impl() { InitializeCriticalSection(&cs); refcount = 1; }
|
Impl() { InitializeCriticalSection(&cs); refcount = 1; }
|
||||||
~Impl() { DeleteCriticalSection(&cs); }
|
~Impl() { DeleteCriticalSection(&cs); }
|
||||||
|
|
||||||
void lock() { EnterCriticalSection(&cs); }
|
void lock() { EnterCriticalSection(&cs); }
|
||||||
bool trylock() { return TryEnterCriticalSection(&cs) != 0; }
|
bool trylock() { return TryEnterCriticalSection(&cs) != 0; }
|
||||||
void unlock() { LeaveCriticalSection(&cs); }
|
void unlock() { LeaveCriticalSection(&cs); }
|
||||||
|
|
||||||
CRITICAL_SECTION cs;
|
CRITICAL_SECTION cs;
|
||||||
int refcount;
|
int refcount;
|
||||||
};
|
};
|
||||||
@ -956,26 +956,26 @@ struct Mutex::Impl
|
|||||||
{
|
{
|
||||||
Impl() { sl = OS_SPINLOCK_INIT; refcount = 1; }
|
Impl() { sl = OS_SPINLOCK_INIT; refcount = 1; }
|
||||||
~Impl() {}
|
~Impl() {}
|
||||||
|
|
||||||
void lock() { OSSpinLockLock(&sl); }
|
void lock() { OSSpinLockLock(&sl); }
|
||||||
bool trylock() { return OSSpinLockTry(&sl); }
|
bool trylock() { return OSSpinLockTry(&sl); }
|
||||||
void unlock() { OSSpinLockUnlock(&sl); }
|
void unlock() { OSSpinLockUnlock(&sl); }
|
||||||
|
|
||||||
OSSpinLock sl;
|
OSSpinLock sl;
|
||||||
int refcount;
|
int refcount;
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif defined __linux__
|
#elif defined __linux__ && !defined ANDROID
|
||||||
|
|
||||||
struct Mutex::Impl
|
struct Mutex::Impl
|
||||||
{
|
{
|
||||||
Impl() { pthread_spin_init(&sl, 0); refcount = 1; }
|
Impl() { pthread_spin_init(&sl, 0); refcount = 1; }
|
||||||
~Impl() { pthread_spin_destroy(&sl); }
|
~Impl() { pthread_spin_destroy(&sl); }
|
||||||
|
|
||||||
void lock() { pthread_spin_lock(&sl); }
|
void lock() { pthread_spin_lock(&sl); }
|
||||||
bool trylock() { return pthread_spin_trylock(&sl) == 0; }
|
bool trylock() { return pthread_spin_trylock(&sl) == 0; }
|
||||||
void unlock() { pthread_spin_unlock(&sl); }
|
void unlock() { pthread_spin_unlock(&sl); }
|
||||||
|
|
||||||
pthread_spinlock_t sl;
|
pthread_spinlock_t sl;
|
||||||
int refcount;
|
int refcount;
|
||||||
};
|
};
|
||||||
@ -986,11 +986,11 @@ struct Mutex::Impl
|
|||||||
{
|
{
|
||||||
Impl() { pthread_mutex_init(&sl, 0); refcount = 1; }
|
Impl() { pthread_mutex_init(&sl, 0); refcount = 1; }
|
||||||
~Impl() { pthread_mutex_destroy(&sl); }
|
~Impl() { pthread_mutex_destroy(&sl); }
|
||||||
|
|
||||||
void lock() { pthread_mutex_lock(&sl); }
|
void lock() { pthread_mutex_lock(&sl); }
|
||||||
bool trylock() { return pthread_mutex_trylock(&sl) == 0; }
|
bool trylock() { return pthread_mutex_trylock(&sl) == 0; }
|
||||||
void unlock() { pthread_mutex_unlock(&sl); }
|
void unlock() { pthread_mutex_unlock(&sl); }
|
||||||
|
|
||||||
pthread_mutex_t sl;
|
pthread_mutex_t sl;
|
||||||
int refcount;
|
int refcount;
|
||||||
};
|
};
|
||||||
@ -1001,14 +1001,14 @@ Mutex::Mutex()
|
|||||||
{
|
{
|
||||||
impl = new Mutex::Impl;
|
impl = new Mutex::Impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mutex::~Mutex()
|
Mutex::~Mutex()
|
||||||
{
|
{
|
||||||
if( CV_XADD(&impl->refcount, -1) == 1 )
|
if( CV_XADD(&impl->refcount, -1) == 1 )
|
||||||
delete impl;
|
delete impl;
|
||||||
impl = 0;
|
impl = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mutex::Mutex(const Mutex& m)
|
Mutex::Mutex(const Mutex& m)
|
||||||
{
|
{
|
||||||
impl = m.impl;
|
impl = m.impl;
|
||||||
@ -1023,10 +1023,10 @@ Mutex& Mutex::operator = (const Mutex& m)
|
|||||||
impl = m.impl;
|
impl = m.impl;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mutex::lock() { impl->lock(); }
|
void Mutex::lock() { impl->lock(); }
|
||||||
void Mutex::unlock() { impl->unlock(); }
|
void Mutex::unlock() { impl->unlock(); }
|
||||||
bool Mutex::trylock() { return impl->trylock(); }
|
bool Mutex::trylock() { return impl->trylock(); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user