class Mutex {
public:
enum {
- NORMAL = 0,
+ PRIVATE = 0,
SHARED = 1
};
*/
class Condition {
public:
+ enum {
+ PRIVATE = 0,
+ SHARED = 1
+ };
+
Condition();
+ Condition(int type);
~Condition();
// Wait on the condition variable. Lock the mutex before calling.
status_t wait(Mutex& mutex);
inline Condition::Condition() {
pthread_cond_init(&mCond, NULL);
}
+inline Condition::Condition(int type) {
+ if (type == SHARED) {
+ pthread_condattr_t attr;
+ pthread_condattr_init(&attr);
+ pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
+ pthread_cond_init(&mCond, &attr);
+ pthread_condattr_destroy(&attr);
+ } else {
+ pthread_cond_init(&mCond, NULL);
+ }
+}
inline Condition::~Condition() {
pthread_cond_destroy(&mCond);
}
// =========================================================================
audio_track_cblk_t::audio_track_cblk_t()
- : lock(Mutex::SHARED), user(0), server(0), userBase(0), serverBase(0), buffers(0), frameCount(0),
- loopStart(UINT_MAX), loopEnd(UINT_MAX), loopCount(0), volumeLR(0), flowControlFlag(1), forceReady(0)
+ : lock(Mutex::SHARED), cv(Condition::SHARED), user(0), server(0),
+ userBase(0), serverBase(0), buffers(0), frameCount(0),
+ loopStart(UINT_MAX), loopEnd(UINT_MAX), loopCount(0), volumeLR(0),
+ flowControlFlag(1), forceReady(0)
{
}