projects
/
platform
/
upstream
/
dbus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Define DBUS_COMPILATION externally for all tests that use internal stuff
[platform/upstream/dbus.git]
/
test
/
internals
/
refs.c
diff --git
a/test/internals/refs.c
b/test/internals/refs.c
index
bc0884e
..
202dc04
100644
(file)
--- a/
test/internals/refs.c
+++ b/
test/internals/refs.c
@@
-27,8
+27,8
@@
#include <config.h>
#include <glib.h>
#include <config.h>
#include <glib.h>
+#include <glib-object.h>
-#define DBUS_COMPILATION /* this test uses libdbus-internal */
#include <dbus/dbus.h>
#include <dbus/dbus-connection-internal.h>
#include <dbus/dbus-mainloop.h>
#include <dbus/dbus.h>
#include <dbus/dbus-connection-internal.h>
#include <dbus/dbus-mainloop.h>
@@
-77,6
+77,11
@@
typedef struct {
VoidFunc unlock;
} Thread;
VoidFunc unlock;
} Thread;
+/* provide backwards compatibility shim when building with a glib <= 2.30.x */
+#if !GLIB_CHECK_VERSION(2,31,0)
+#define g_thread_new(name,func,data) g_thread_create(func,data,TRUE,NULL)
+#endif
+
static gpointer
ref_thread (gpointer data)
{
static gpointer
ref_thread (gpointer data)
{
@@
-276,10
+281,9
@@
test_connection (Fixture *f,
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
- f->threads[i] = g_thread_
create (ref_thread, &public_api, TRUE, NULL
);
+ f->threads[i] = g_thread_
new (NULL, ref_thread, &public_api
);
else
else
- f->threads[i] = g_thread_create (ref_thread, &internal_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, ref_thread, &internal_api);
g_assert (f->threads[i] != NULL);
}
g_assert (f->threads[i] != NULL);
}
@@
-289,11
+293,9
@@
test_connection (Fixture *f,
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
- f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, cycle_thread, &public_api);
else
else
- f->threads[i] = g_thread_create (cycle_thread, &internal_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, cycle_thread, &internal_api);
g_assert (f->threads[i] != NULL);
}
g_assert (f->threads[i] != NULL);
}
@@
-303,11
+305,9
@@
test_connection (Fixture *f,
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
- f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, unref_thread, &public_api);
else
else
- f->threads[i] = g_thread_create (unref_thread, &internal_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, unref_thread, &internal_api);
g_assert (f->threads[i] != NULL);
}
g_assert (f->threads[i] != NULL);
}
@@
-360,10
+360,9
@@
test_server (Fixture *f,
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
- f->threads[i] = g_thread_
create (ref_thread, &public_api, TRUE, NULL
);
+ f->threads[i] = g_thread_
new (NULL, ref_thread, &public_api
);
else
else
- f->threads[i] = g_thread_create (ref_thread, &internal_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, ref_thread, &internal_api);
g_assert (f->threads[i] != NULL);
}
g_assert (f->threads[i] != NULL);
}
@@
-373,11
+372,9
@@
test_server (Fixture *f,
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
- f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, cycle_thread, &public_api);
else
else
- f->threads[i] = g_thread_create (cycle_thread, &internal_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, cycle_thread, &internal_api);
g_assert (f->threads[i] != NULL);
}
g_assert (f->threads[i] != NULL);
}
@@
-387,11
+384,9
@@
test_server (Fixture *f,
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
- f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, unref_thread, &public_api);
else
else
- f->threads[i] = g_thread_create (unref_thread, &internal_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, unref_thread, &internal_api);
g_assert (f->threads[i] != NULL);
}
g_assert (f->threads[i] != NULL);
}
@@
-426,7
+421,7
@@
test_message (Fixture *f,
for (i = 0; i < N_THREADS; i++)
{
for (i = 0; i < N_THREADS; i++)
{
- f->threads[i] = g_thread_
create (ref_thread, &public_api, TRUE, NULL
);
+ f->threads[i] = g_thread_
new (NULL, ref_thread, &public_api
);
g_assert (f->threads[i] != NULL);
}
g_assert (f->threads[i] != NULL);
}
@@
-434,7
+429,7
@@
test_message (Fixture *f,
for (i = 0; i < N_THREADS; i++)
{
for (i = 0; i < N_THREADS; i++)
{
- f->threads[i] = g_thread_
create (cycle_thread, &public_api, TRUE, NULL
);
+ f->threads[i] = g_thread_
new (NULL, cycle_thread, &public_api
);
g_assert (f->threads[i] != NULL);
}
g_assert (f->threads[i] != NULL);
}
@@
-442,7
+437,7
@@
test_message (Fixture *f,
for (i = 0; i < N_THREADS; i++)
{
for (i = 0; i < N_THREADS; i++)
{
- f->threads[i] = g_thread_
create (unref_thread, &public_api, TRUE, NULL
);
+ f->threads[i] = g_thread_
new (NULL, unref_thread, &public_api
);
g_assert (f->threads[i] != NULL);
}
g_assert (f->threads[i] != NULL);
}
@@
-500,10
+495,9
@@
test_pending_call (Fixture *f,
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
for (i = 0; i < N_THREADS; i++)
{
if ((i % 2) == 0)
- f->threads[i] = g_thread_
create (ref_thread, &public_api, TRUE, NULL
);
+ f->threads[i] = g_thread_
new (NULL, ref_thread, &public_api
);
else
else
- f->threads[i] = g_thread_create (ref_thread, &internal_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, ref_thread, &internal_api);
g_assert (f->threads[i] != NULL);
}
g_assert (f->threads[i] != NULL);
}
@@
-515,16
+509,14
@@
test_pending_call (Fixture *f,
switch (i % 3)
{
case 0:
switch (i % 3)
{
case 0:
- f->threads[i] = g_thread_create (cycle_thread, &public_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, cycle_thread, &public_api);
break;
case 1:
break;
case 1:
- f->threads[i] = g_thread_create (cycle_thread, &internal_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, cycle_thread, &internal_api);
break;
default:
break;
default:
- f->threads[i] = g_thread_
create (
cycle_thread,
- &unref_and_unlock_api
, TRUE, NULL
);
+ f->threads[i] = g_thread_
new (NULL,
cycle_thread,
+ &unref_and_unlock_api);
}
g_assert (f->threads[i] != NULL);
}
g_assert (f->threads[i] != NULL);
@@
-537,16
+529,14
@@
test_pending_call (Fixture *f,
switch (i % 3)
{
case 0:
switch (i % 3)
{
case 0:
- f->threads[i] = g_thread_create (unref_thread, &public_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, unref_thread, &public_api);
break;
case 1:
break;
case 1:
- f->threads[i] = g_thread_create (unref_thread, &internal_api, TRUE,
- NULL);
+ f->threads[i] = g_thread_new (NULL, unref_thread, &internal_api);
break;
default:
break;
default:
- f->threads[i] = g_thread_
create (
unref_thread,
- &unref_and_unlock_api
, TRUE, NULL
);
+ f->threads[i] = g_thread_
new (NULL,
unref_thread,
+ &unref_and_unlock_api);
}
g_assert (f->threads[i] != NULL);
}
g_assert (f->threads[i] != NULL);
@@
-595,7
+585,12
@@
int
main (int argc,
char **argv)
{
main (int argc,
char **argv)
{
- g_thread_init (NULL);
+ /* In GLib >= 2.24, < 2.31 this acts like g_thread_init() but avoids
+ * the deprecation of that function. In GLib >= 2.32 this is not
+ * necessary at all.
+ */
+ g_type_init ();
+
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");