Revert "Deprecate clutter_threads_init()"

This reverts commit 7e3a75c66bbca1e278b15c797cfc6acbcbd6c7c7.

Conflicts:

	clutter/clutter-main.c
	clutter/clutter-main.h
This commit is contained in:
Chun-wei Fan 2011-10-20 15:17:25 +08:00
parent e33a6219d8
commit 5419c11c99
5 changed files with 30 additions and 13 deletions

View File

@ -34,7 +34,7 @@
* <para>Clutter is <emphasis>thread-aware</emphasis>: all operations * <para>Clutter is <emphasis>thread-aware</emphasis>: all operations
* performed by Clutter are assumed to be under the big Clutter lock, * performed by Clutter are assumed to be under the big Clutter lock,
* which is created when the threading is initialized through * which is created when the threading is initialized through
* clutter_init().</para> * clutter_threads_init().</para>
* <example id="example-Thread-Init"> * <example id="example-Thread-Init">
* <title>Thread Initialization</title> * <title>Thread Initialization</title>
* <para>The code below shows how to correctly initialize Clutter * <para>The code below shows how to correctly initialize Clutter
@ -44,6 +44,12 @@
* int * int
* main (int argc, char *argv[]) * main (int argc, char *argv[])
* { * {
* /&ast; initialize GLib's threading support &ast;/
* g_thread_init (NULL);
*
* /&ast; initialize Clutter's threading support &ast;/
* clutter_threads_init ();
*
* /&ast; initialize Clutter &ast;/ * /&ast; initialize Clutter &ast;/
* clutter_init (&amp;argc, &amp;argv); * clutter_init (&amp;argc, &amp;argv);
* *
@ -910,6 +916,18 @@ clutter_main (void)
CLUTTER_TIMER_STOP (uprof_get_mainloop_context (), mainloop_timer); CLUTTER_TIMER_STOP (uprof_get_mainloop_context (), mainloop_timer);
} }
static void
clutter_threads_impl_lock (void)
{
g_mutex_lock (&clutter_threads_mutex);
}
static void
clutter_threads_impl_unlock (void)
{
g_mutex_unlock (&clutter_threads_mutex);
}
/** /**
* clutter_threads_init: * clutter_threads_init:
* *
@ -924,13 +942,15 @@ clutter_main (void)
* It is safe to call this function multiple times. * It is safe to call this function multiple times.
* *
* Since: 0.4 * Since: 0.4
*
* Deprecated: 1.10: This function does not do anything. Threading support
* is initialized when Clutter is initialized.
*/ */
void void
clutter_threads_init (void) clutter_threads_init (void)
{ {
if (clutter_threads_lock == NULL)
clutter_threads_lock = clutter_threads_impl_lock;
if (clutter_threads_unlock == NULL)
clutter_threads_unlock = clutter_threads_impl_unlock;
} }
/** /**
@ -2584,9 +2604,6 @@ clutter_base_init (void)
/* initialise GLib type system */ /* initialise GLib type system */
g_type_init (); g_type_init ();
/* initialise the Big Clutter Lock™ if necessary */
clutter_threads_init_default ();
} }
} }

View File

@ -110,11 +110,7 @@ gulong clutter_get_timestamp (void);
gboolean clutter_get_accessibility_enabled (void); gboolean clutter_get_accessibility_enabled (void);
/* Threading functions */ /* Threading functions */
#if !defined(CLUTTER_DISABLE_DEPRECATED) || defined(CLUTTER_COMPILATION)
CLUTTER_DEPRECATED
void clutter_threads_init (void); void clutter_threads_init (void);
#endif
void clutter_threads_enter (void); void clutter_threads_enter (void);
void clutter_threads_leave (void); void clutter_threads_leave (void);
void clutter_threads_set_lock_functions (GCallback enter_fn, void clutter_threads_set_lock_functions (GCallback enter_fn,

View File

@ -120,6 +120,8 @@ test_texture_async_main (int argc, char *argv[])
{ {
gchar *path; gchar *path;
clutter_threads_init ();
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;
@ -138,9 +140,7 @@ test_texture_async_main (int argc, char *argv[])
task, path, task, path,
cleanup_task); cleanup_task);
clutter_threads_enter ();
clutter_main (); clutter_main ();
clutter_threads_leave ();
g_free (path); g_free (path);

View File

@ -10,6 +10,8 @@ test_texture_material_main (int argc, char *argv[])
ClutterLayoutManager *manager; ClutterLayoutManager *manager;
int i; int i;
g_thread_init (NULL);
clutter_threads_init ();
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;

View File

@ -209,6 +209,8 @@ test_threads_main (int argc, char *argv[])
{ 400, 150 } { 400, 150 }
}; };
g_thread_init (NULL);
clutter_threads_init ();
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1; return 1;