X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Flinux%2Fgp2x.c;h=3b43c3d37b690f89d1a85597ff2514002544048a;hb=69996cb7c62468cd97842e35bdd2b74006a28dba;hp=f5da1670c766a48ba09b454aac2fd6285eb54ffa;hpb=83c093a48ab58670ea82d0ec81658daa9f9b950a;p=picodrive.git diff --git a/platform/linux/gp2x.c b/platform/linux/gp2x.c index f5da167..3b43c3d 100644 --- a/platform/linux/gp2x.c +++ b/platform/linux/gp2x.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -98,22 +99,12 @@ static gint key_release_event (GtkWidget *widget, GdkEventKey *event) return 0; } -static void *gtk_threadf(void *none) -{ - gtk_main(); - - printf("linux: gtk thread finishing\n"); - engineState = PGS_Quit; - - return NULL; -} - -static void gtk_initf(void) +static void *gtk_threadf(void *targ) { int argc = 0; char *argv[] = { "" }; GtkWidget *box; - pthread_t gtk_thread; + sem_t *sem = targ; g_thread_init (NULL); gdk_threads_init (); @@ -149,11 +140,27 @@ static void gtk_initf(void) gtk_widget_show (gtk_items.window); - // pthread_mutex_init (&thr_mutex, NULL); - // pthread_mutex_lock (&thr_mutex); - // pthread_mutex_init (&scanner_muttex, NULL); + sem_post(sem); + + gtk_main(); + + printf("linux: gtk thread finishing\n"); + exit(1); + + return NULL; +} + +static void gtk_initf(void) +{ + pthread_t gtk_thread; + sem_t sem; + sem_init(&sem, 0, 0); + + pthread_create(>k_thread, NULL, gtk_threadf, &sem); + pthread_detach(gtk_thread); - pthread_create(>k_thread, NULL, gtk_threadf, NULL); + sem_wait(&sem); + sem_close(&sem); } void finalize_image(guchar *pixels, gpointer data)