]> Pileus Git - ~andy/gtk/blobdiff - tests/testthreads.c
Merges from gtk-1-2
[~andy/gtk] / tests / testthreads.c
index c89ad588548116a004eec5a0c8c7ab23aebcb588..c10cbecdaed5a4368399382fad39068183c0bc59 100644 (file)
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
 #include <stdio.h>
 #include <unistd.h>
 #include <gtk/gtk.h>
@@ -53,7 +61,7 @@ counter (void *data)
   GtkWidget *label;
   GtkWidget *button;
 
-  gtk_threads_enter();
+  gdk_threads_enter();
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_set_title (GTK_WINDOW (window), name);
@@ -82,8 +90,8 @@ counter (void *data)
   while (!flag)
     {
       sprintf(buffer, "%d", counter);
-      gtk_label_set (GTK_LABEL (label), buffer);
-      gtk_threads_leave();
+      gtk_label_set_text (GTK_LABEL (label), buffer);
+      gdk_threads_leave();
       counter++;
       /* Give someone else a chance to get the lock next time.
        * Only necessary because we don't do anything else while
@@ -91,7 +99,7 @@ counter (void *data)
        */
       sleep(0);
       
-      gtk_threads_enter();
+      gdk_threads_enter();
     }
 
   gtk_widget_destroy (window);
@@ -102,7 +110,7 @@ counter (void *data)
     gtk_main_quit();
   pthread_mutex_unlock (&nthreads_mutex);
 
-  gtk_threads_leave();
+  gdk_threads_leave();
 
   return NULL;
 }
@@ -115,7 +123,7 @@ main (int argc, char **argv)
 #ifdef USE_PTHREADS
   int i;
 
-  if (!gtk_threads_init())
+  if (!gdk_threads_init())
     {
       fprintf(stderr, "Could not initialize threads\n");
       exit(1);
@@ -141,9 +149,9 @@ main (int argc, char **argv)
 
   pthread_mutex_unlock (&nthreads_mutex);
 
-  gtk_threads_enter();
+  gdk_threads_enter();
   gtk_main();
-  gtk_threads_leave();
+  gdk_threads_leave();
   fprintf(stderr, "Done\n");
 #else /* !USE_PTHREADS */
   fprintf (stderr, "GTK+ not compiled with threads support\n");