Diff
Not logged in

Differences From Artifact [cfb8163b83]:

To Artifact [48c3e6a8d3]:


80
81
82
83
84
85
86


87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

116
117
118
119
120
121
122
    int counter; // Number of additional locks in the same thread.
} PMutex;

static void
PMutexInit(
    PMutex *pmutexPtr)
{


    pthread_mutex_init(&pmutexPtr->mutex, NULL);
#if defined(HAVE_STDATOMIC_H)
    __atomic_store_n(&pmutexPtr->thread, 0, __ATOMIC_SEQ_CST);
#else
# if defined(HAVE_PTHREAD_SPIN_LOCK)
    pthread_spin_init(&pmutexPtr->lock, PTHREAD_PROCESS_PRIVATE);
    pthread_spin_lock(&pmutexPtr->lock);
# endif
    pmutexPtr->thread = 0;
# if defined(HAVE_PTHREAD_SPIN_LOCK)
    pthread_spin_unlock(&pmutexPtr->lock);
# endif
#endif
    pmutexPtr->counter = 0;
}

static void
PMutexDestroy(
    PMutex *pmutexPtr)
{
#ifdef HAVE_STDATOMIC_H
    assert(__atomic_load_n(&pmutexPtr->thread, __ATOMIC_SEQ_CST) == 0);
#else
    assert(mutexPtr->thread == 0);
# if defined(HAVE_PTHREAD_SPIN_LOCK)
    pthread_spin_destroy(&pmutexPtr->lock);
# endif
#endif
    pthread_mutex_destroy(&pmutexPtr->mutex);

}

#ifdef HAVE_STDATOMIC_H

static void
PMutexLock(
    PMutex *pmutexPtr)







>
>

<
<
<
|

<
<
<
<
<
<

<






<
<
<
<
|

<


>







80
81
82
83
84
85
86
87
88
89



90
91






92

93
94
95
96
97
98




99
100

101
102
103
104
105
106
107
108
109
110
    int counter; // Number of additional locks in the same thread.
} PMutex;

static void
PMutexInit(
    PMutex *pmutexPtr)
{
    pmutexPtr->thread = 0;
    pmutexPtr->counter = 0;
    pthread_mutex_init(&pmutexPtr->mutex, NULL);



#if defined(HAVE_PTHREAD_SPIN_LOCK) && !defined(HAVE_STDATOMIC_H)
    pthread_spin_init(&pmutexPtr->lock, PTHREAD_PROCESS_PRIVATE);






#endif

}

static void
PMutexDestroy(
    PMutex *pmutexPtr)
{




#if defined(HAVE_PTHREAD_SPIN_LOCK) && !defined(HAVE_STDATOMIC_H)
    pthread_spin_destroy(&pmutexPtr->lock);

#endif
    pthread_mutex_destroy(&pmutexPtr->mutex);
    assert(pmutexPtr->thread == 0 && pmutexPtr->counter = 0);
}

#ifdef HAVE_STDATOMIC_H

static void
PMutexLock(
    PMutex *pmutexPtr)