Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67954789 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge "libutils Condition are now PRIVATE by default"

parents 7d94746b 26d24428
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -209,7 +209,7 @@ inline thread_id_t getThreadId() {
class Mutex {
public:
    enum {
        NORMAL = 0,
        PRIVATE = 0,
        SHARED = 1
    };
    
@@ -305,7 +305,13 @@ typedef Mutex::Autolock AutoMutex;
 */
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);
@@ -329,6 +335,17 @@ private:
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);
}
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ namespace android {
// ----------------------------------------------------------------------------

SharedClient::SharedClient()
    : lock(Mutex::SHARED)
    : lock(Mutex::SHARED), cv(Condition::SHARED)
{
}