aboutsummaryrefslogtreecommitdiff
path: root/tests/benchmarks/gstpollstress.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/gstpollstress.c')
-rw-r--r--tests/benchmarks/gstpollstress.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/benchmarks/gstpollstress.c b/tests/benchmarks/gstpollstress.c
index bf0d548..dfd9caf 100644
--- a/tests/benchmarks/gstpollstress.c
+++ b/tests/benchmarks/gstpollstress.c
@@ -21,10 +21,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <gst/gst.h>
+#include "gst/glib-compat-private.h"
static GstPoll *set;
static GList *fds = NULL;
-static GMutex *fdlock;
+static GMutex fdlock;
static GTimer *timer;
#define MAX_THREADS 100
@@ -36,7 +37,7 @@ mess_some_more (void)
gint random;
gint removed = 0;
- g_mutex_lock (fdlock);
+ g_mutex_lock (&fdlock);
for (walk = fds; walk;) {
GstPollFD *fd = (GstPollFD *) walk->data;
@@ -105,7 +106,7 @@ mess_some_more (void)
}
}
- g_mutex_unlock (fdlock);
+ g_mutex_unlock (&fdlock);
}
static void *
@@ -123,10 +124,10 @@ run_test (void *threadid)
} else {
mess_some_more ();
if (g_timer_elapsed (timer, NULL) > 0.5) {
- g_mutex_lock (fdlock);
+ g_mutex_lock (&fdlock);
g_print ("active fds :%d\n", g_list_length (fds));
g_timer_start (timer);
- g_mutex_unlock (fdlock);
+ g_mutex_unlock (&fdlock);
}
g_usleep (1);
}
@@ -144,7 +145,7 @@ main (gint argc, gchar * argv[])
gst_init (&argc, &argv);
- fdlock = g_mutex_new ();
+ g_mutex_init (&fdlock);
timer = g_timer_new ();
if (argc != 2) {
@@ -159,7 +160,9 @@ main (gint argc, gchar * argv[])
for (t = 0; t < num_threads; t++) {
GError *error = NULL;
- threads[t] = g_thread_create (run_test, GINT_TO_POINTER (t), TRUE, &error);
+ threads[t] = g_thread_try_new ("pollstresstest", run_test,
+ GINT_TO_POINTER (t), &error);
+
if (error) {
printf ("ERROR: g_thread_create() %s\n", error->message);
exit (-1);