2013-11-07
互斥类 -- Mutex
customize/native/include/utils/Mutex.h
a. Mutex
b. AutoLock
条件类 -- Condition
customize/native/include/utils/Condition.h
inline status_t Condition::wait(Mutex& mutex) {
return -pthread_cond_wait(&mCond, &mutex.mMutex);
}
inline status_t Condition::waitRelative(Mutex& mutex, nsecs_t reltime) ;
inline void Condition::signal() {
pthread_cond_signal(&mCond);
}
inline void Condition::broadcast() {
pthread_cond_broadcast(&mCond);
}
原子操作函数
system/core/include/cutils/
extern inline int32_t android_atomic_inc(volatile int32_t *addr)
{
return android_atomic_add(1, addr);
}
extern inline int32_t android_atomic_dec(volatile int32_t *addr)
{
return android_atomic_add(-1, addr);
}
extern inline int32_t android_atomic_and(int32_t value, volatile int32_t *ptr);
extern inline int32_t android_atomic_or(int32_t value, volatile int32_t *ptr);
346

被折叠的 条评论
为什么被折叠?



