free_chunk (chunk);
}
- pthread_exit(NULL);
+ g_thread_exit(NULL);
+ return NULL;
}
gint
main (gint argc, gchar *argv[])
{
- pthread_t threads[MAX_THREADS];
- int rc, t;
+ GThread *threads[MAX_THREADS];
+ GError *error;
+ int t;
gst_init (&argc, &argv);
_lock = g_mutex_new ();
for(t=0; t < num_threads; t++) {
- rc = pthread_create (&threads[t], NULL, run_test, (void *)t);
- if (rc) {
- printf ("ERROR: return code from pthread_create() is %d\n", rc);
- printf ("Code %d= %s\n", rc, strerror(rc));
+ error = NULL;
+ threads[t] = g_thread_create (run_test, (void *)t, TRUE, &error);
+ if (error) {
+ printf ("ERROR: g_thread_create () is %s\n", error->message);
exit (-1);
}
}
printf ("main(): Created %d threads.\n", t);
- pthread_exit (NULL);
+ g_thread_exit (NULL);
g_mem_chunk_info();
+ return 0;
}
free_chunk (chunk);
}
- pthread_exit(NULL);
+ g_thread_exit(NULL);
+ return NULL;
}
gint
main (gint argc, gchar *argv[])
{
- pthread_t threads[MAX_THREADS];
- int rc, t;
+ GThread * threads[MAX_THREADS];
+ GError * error;
+ int t;
gst_init (&argc, &argv);
_chunks = gst_mem_chunk_new ("test", 32, 32 * 16, G_ALLOC_AND_FREE);
for(t=0; t < num_threads; t++) {
- rc = pthread_create (&threads[t], NULL, run_test, (void *)t);
- if (rc) {
- printf ("ERROR: return code from pthread_create() is %d\n", rc);
- printf ("Code %d= %s\n", rc, strerror(rc));
+ error = NULL;
+ threads[t] = g_thread_create (run_test, (void *)t, TRUE, &error);
+ if (error) {
+ printf ("ERROR: g_thread_create() %s\n", error->message);
exit (-1);
}
}
printf ("main(): Created %d threads.\n", t);
for(t=0; t < num_threads; t++) {
- pthread_join (threads[t], NULL);
+ g_thread_join (threads[t]);
}
g_mem_chunk_info();