mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
gthread-posix: Don't use gslice allocated GRecMutex
This leads to problems during cleanup, and seems strange to have locks defined in terms of things that need locking. https://bugzilla.gnome.org/show_bug.cgi?id=711753
This commit is contained in:
@@ -268,7 +268,10 @@ g_rec_mutex_impl_new (void)
|
|||||||
pthread_mutexattr_t attr;
|
pthread_mutexattr_t attr;
|
||||||
pthread_mutex_t *mutex;
|
pthread_mutex_t *mutex;
|
||||||
|
|
||||||
mutex = g_slice_new (pthread_mutex_t);
|
mutex = malloc (sizeof (pthread_mutex_t));
|
||||||
|
if G_UNLIKELY (mutex == NULL)
|
||||||
|
g_thread_abort (errno, "malloc");
|
||||||
|
|
||||||
pthread_mutexattr_init (&attr);
|
pthread_mutexattr_init (&attr);
|
||||||
pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
|
pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||||
pthread_mutex_init (mutex, &attr);
|
pthread_mutex_init (mutex, &attr);
|
||||||
@@ -281,7 +284,7 @@ static void
|
|||||||
g_rec_mutex_impl_free (pthread_mutex_t *mutex)
|
g_rec_mutex_impl_free (pthread_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
pthread_mutex_destroy (mutex);
|
pthread_mutex_destroy (mutex);
|
||||||
g_slice_free (pthread_mutex_t, mutex);
|
free (mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static pthread_mutex_t *
|
static pthread_mutex_t *
|
||||||
|
Reference in New Issue
Block a user