$NetBSD: patch-ac,v 1.7 2004/01/04 21:37:09 rh Exp $

--- shell/main.c.orig	2003-07-29 01:19:13.000000000 +1000
+++ shell/main.c
@@ -91,6 +91,25 @@ static gboolean killev = FALSE;
 
 extern char *evolution_debug_log;
 
+#ifdef __NetBSD__
+#include <gtk/gtk.h>
+#include <pthread.h>
+
+/*
+ * Pth is non-preemptive, so we yield the processor periodically
+ */
+
+#ifdef _PTH_PTHREAD_H_
+static gint
+pth_nbschedule (gpointer data)
+{
+	sched_yield();
+
+	return TRUE;
+}
+#endif /* _PTH_PTHREAD_H_ */
+#endif /* __NetBSD__ */
+
 
 static GtkWidget *
 quit_box_new (void)
@@ -374,6 +393,10 @@ idle_cb (void *data)
 	else
 		startup_line_mode = E_SHELL_STARTUP_LINE_MODE_OFFLINE;
 
+#ifdef _PTH_PTHREAD_H_
+	sched_yield();
+#endif
+
 	shell = e_shell_new (evolution_directory, ! no_splash, startup_line_mode, &result);
 	g_free (evolution_directory);
 
@@ -634,6 +657,10 @@ main (int argc, char **argv)
 
 	gtk_idle_add (idle_cb, uri_list);
 
+#ifdef _PTH_PTHREAD_H_
+	gtk_timeout_add (200, pth_nbschedule, NULL);
+#endif
+
 	bonobo_main ();
 
 	return 0;
