while (running) {
gst_clock_get_time (sysclock);
- prev = G_ATOMIC_INT_ADD (&count, 1);
+ prev = g_atomic_int_add (&count, 1);
if (prev == G_MAXINT)
g_warning ("overflow");
}
num_threads = atoi (argv[1]);
+ if (num_threads <= 0 || num_threads > MAX_THREADS) {
+ g_print ("number of threads must be between 0 and %d\n", MAX_THREADS);
+ exit (-2);
+ }
+
sysclock = gst_system_clock_obtain ();
for (t = 0; t < num_threads; t++) {
GError *error = NULL;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- threads[t] = g_thread_create (run_test, sysclock, TRUE, &error);
-#else
threads[t] = g_thread_try_new ("clockstresstest", run_test,
sysclock, &error);
-#endif
+
if (error) {
printf ("ERROR: g_thread_create() %s\n", error->message);
exit (-1);