mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-10 03:04:05 +02:00
Deprecate g_{mutex,cond}_{new,free}()
Now that we have _init() and _clear(), these old calls are no longer useful. https://bugzilla.gnome.org/show_bug.cgi?id=660739
This commit is contained in:
@@ -1406,5 +1406,89 @@ g_static_private_cleanup (GRealThread *thread)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* GMutex {{{1 ------------------------------------------------------ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_mutex_new:
|
||||||
|
*
|
||||||
|
* Allocates and initializes a new #GMutex.
|
||||||
|
*
|
||||||
|
* Returns: a newly allocated #GMutex. Use g_mutex_free() to free
|
||||||
|
*
|
||||||
|
* Deprecated:3.32:GMutex can now be statically allocated, or embedded
|
||||||
|
* in structures and initialised with g_mutex_init().
|
||||||
|
*/
|
||||||
|
GMutex *
|
||||||
|
g_mutex_new (void)
|
||||||
|
{
|
||||||
|
GMutex *mutex;
|
||||||
|
|
||||||
|
mutex = g_slice_new (GMutex);
|
||||||
|
g_mutex_init (mutex);
|
||||||
|
|
||||||
|
return mutex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_mutex_free:
|
||||||
|
* @mutex: a #GMutex
|
||||||
|
*
|
||||||
|
* Destroys a @mutex that has been created with g_mutex_new().
|
||||||
|
*
|
||||||
|
* Calling g_mutex_free() on a locked mutex may result
|
||||||
|
* in undefined behaviour.
|
||||||
|
*
|
||||||
|
* Deprecated:3.32:GMutex can now be statically allocated, or embedded
|
||||||
|
* in structures and initialised with g_mutex_init().
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
g_mutex_free (GMutex *mutex)
|
||||||
|
{
|
||||||
|
g_mutex_clear (mutex);
|
||||||
|
g_slice_free (GMutex, mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GCond {{{1 ------------------------------------------------------ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_cond_new:
|
||||||
|
*
|
||||||
|
* Allocates and initializes a new #GCond.
|
||||||
|
*
|
||||||
|
* Returns: a newly allocated #GCond. Free with g_cond_free()
|
||||||
|
*
|
||||||
|
* Deprecated:3.32:GCond can now be statically allocated, or embedded
|
||||||
|
* in structures and initialised with g_cond_init().
|
||||||
|
*/
|
||||||
|
GCond *
|
||||||
|
g_cond_new (void)
|
||||||
|
{
|
||||||
|
GCond *cond;
|
||||||
|
|
||||||
|
cond = g_slice_new (GCond);
|
||||||
|
g_cond_init (cond);
|
||||||
|
|
||||||
|
return cond;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_cond_free:
|
||||||
|
* @cond: a #GCond
|
||||||
|
*
|
||||||
|
* Destroys a #GCond that has been created with g_cond_new().
|
||||||
|
*
|
||||||
|
* Calling g_cond_free() for a #GCond on which threads are
|
||||||
|
* blocking leads to undefined behaviour.
|
||||||
|
*
|
||||||
|
* Deprecated:3.32:GCond can now be statically allocated, or embedded
|
||||||
|
* in structures and initialised with g_cond_init().
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
g_cond_free (GCond *cond)
|
||||||
|
{
|
||||||
|
g_cond_clear (cond);
|
||||||
|
g_slice_free (GCond, cond);
|
||||||
|
}
|
||||||
|
|
||||||
/* {{{1 Epilogue */
|
/* {{{1 Epilogue */
|
||||||
/* vim: set foldmethod=marker: */
|
/* vim: set foldmethod=marker: */
|
||||||
|
@@ -214,6 +214,10 @@ GLIB_VAR gboolean g_threads_got_initialized;
|
|||||||
|
|
||||||
GMutex* g_static_mutex_get_mutex_impl (GMutex **mutex);
|
GMutex* g_static_mutex_get_mutex_impl (GMutex **mutex);
|
||||||
|
|
||||||
|
GMutex * g_mutex_new (void);
|
||||||
|
void g_mutex_free (GMutex *mutex);
|
||||||
|
GCond * g_cond_new (void);
|
||||||
|
void g_cond_free (GCond *cond);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@@ -1022,77 +1022,5 @@ g_thread_self (void)
|
|||||||
return (GThread*)thread;
|
return (GThread*)thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GMutex {{{1 ------------------------------------------------------ */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_mutex_new:
|
|
||||||
*
|
|
||||||
* Allocates and initializes a new #GMutex.
|
|
||||||
*
|
|
||||||
* Returns: a newly allocated #GMutex. Use g_mutex_free() to free
|
|
||||||
*/
|
|
||||||
GMutex *
|
|
||||||
g_mutex_new (void)
|
|
||||||
{
|
|
||||||
GMutex *mutex;
|
|
||||||
|
|
||||||
mutex = g_slice_new (GMutex);
|
|
||||||
g_mutex_init (mutex);
|
|
||||||
|
|
||||||
return mutex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_mutex_free:
|
|
||||||
* @mutex: a #GMutex
|
|
||||||
*
|
|
||||||
* Destroys a @mutex that has been created with g_mutex_new().
|
|
||||||
*
|
|
||||||
* Calling g_mutex_free() on a locked mutex may result
|
|
||||||
* in undefined behaviour.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
g_mutex_free (GMutex *mutex)
|
|
||||||
{
|
|
||||||
g_mutex_clear (mutex);
|
|
||||||
g_slice_free (GMutex, mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GCond {{{1 ------------------------------------------------------ */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_cond_new:
|
|
||||||
*
|
|
||||||
* Allocates and initializes a new #GCond.
|
|
||||||
*
|
|
||||||
* Returns: a newly allocated #GCond. Free with g_cond_free()
|
|
||||||
*/
|
|
||||||
GCond *
|
|
||||||
g_cond_new (void)
|
|
||||||
{
|
|
||||||
GCond *cond;
|
|
||||||
|
|
||||||
cond = g_slice_new (GCond);
|
|
||||||
g_cond_init (cond);
|
|
||||||
|
|
||||||
return cond;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_cond_free:
|
|
||||||
* @cond: a #GCond
|
|
||||||
*
|
|
||||||
* Destroys a #GCond that has been created with g_cond_new().
|
|
||||||
*
|
|
||||||
* Calling g_cond_free() for a #GCond on which threads are
|
|
||||||
* blocking leads to undefined behaviour.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
g_cond_free (GCond *cond)
|
|
||||||
{
|
|
||||||
g_cond_clear (cond);
|
|
||||||
g_slice_free (GCond, cond);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Epilogue {{{1 */
|
/* Epilogue {{{1 */
|
||||||
/* vim: set foldmethod=marker: */
|
/* vim: set foldmethod=marker: */
|
||||||
|
@@ -198,8 +198,6 @@ void g_once_init_leave (volatile void *location,
|
|||||||
#endif /* !G_DEBUG_LOCKS */
|
#endif /* !G_DEBUG_LOCKS */
|
||||||
|
|
||||||
|
|
||||||
GMutex * g_mutex_new (void);
|
|
||||||
void g_mutex_free (GMutex *mutex);
|
|
||||||
void g_mutex_init (GMutex *mutex);
|
void g_mutex_init (GMutex *mutex);
|
||||||
void g_mutex_clear (GMutex *mutex);
|
void g_mutex_clear (GMutex *mutex);
|
||||||
|
|
||||||
@@ -222,8 +220,6 @@ void g_rec_mutex_lock (GRecMut
|
|||||||
gboolean g_rec_mutex_trylock (GRecMutex *rec_mutex);
|
gboolean g_rec_mutex_trylock (GRecMutex *rec_mutex);
|
||||||
void g_rec_mutex_unlock (GRecMutex *rec_mutex);
|
void g_rec_mutex_unlock (GRecMutex *rec_mutex);
|
||||||
|
|
||||||
GCond * g_cond_new (void);
|
|
||||||
void g_cond_free (GCond *cond);
|
|
||||||
void g_cond_init (GCond *cond);
|
void g_cond_init (GCond *cond);
|
||||||
void g_cond_clear (GCond *cond);
|
void g_cond_clear (GCond *cond);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user