summaryrefslogtreecommitdiff
path: root/audio/xmms/patches/patch-ai
blob: 0181351c1258df9ebb8779e032755245279adb1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
$NetBSD: patch-ai,v 1.4 2001/06/21 16:38:34 rh Exp $

--- xmms/main.c.orig	Sun Jun 17 01:05:47 2001
+++ xmms/main.c
@@ -36,6 +36,23 @@
 #include "libxmms/dirbrowser.h"
 #include "xmms_mini.xpm"
 
+#ifdef __NetBSD__
+#include <gtk/gtk.h>
+#include <pthread.h>
+
+/*
+ * NetBSD uses non-preemptive pth, so we yield the processor periodically
+ */
+
+gint
+pth_nbschedule (gpointer data)
+{
+	pthread_yield_np();
+
+	return TRUE;
+}
+#endif
+
 GtkWidget *mainwin, *mainwin_url_window = NULL, *mainwin_dir_browser = NULL;
 GtkWidget *mainwin_jtt = NULL, *mainwin_jtf = NULL;
 GtkItemFactory *mainwin_options_menu, *mainwin_songname_menu, *mainwin_vis_menu;
@@ -3330,7 +3347,7 @@
 {
 	gchar *filename;
 	struct cmdlineopt options;
-#if defined(HAVE_SCHED_SETSCHEDULER) && defined(HAVE_SCHED_GET_PRIORITY_MAX)
+#if defined(HAVE_SCHED_SETSCHEDULER) && defined(HAVE_SCHED_GET_PRIORITY_MAX) && !defined(__NetBSD__)
 	struct sched_param sparam;
 
 #endif
@@ -3361,7 +3378,7 @@
 
 	if (geteuid() == 0)
 	{
-#if defined(HAVE_SCHED_SETSCHEDULER) && defined(HAVE_SCHED_GET_PRIORITY_MAX)
+#if defined(HAVE_SCHED_SETSCHEDULER) && defined(HAVE_SCHED_GET_PRIORITY_MAX) && !defined(__NetBSD__)
 		if (cfg.use_realtime)
 		{
 			sparam.sched_priority = sched_get_priority_max(SCHED_RR);
@@ -3450,6 +3467,11 @@
 
 	/* enable_x11r5_session_management(argc, argv); */
 	sm_init(argc, argv);
+
+#ifdef __NetBSD__
+	gtk_timeout_add (150, pth_nbschedule, NULL);
+#endif
+
 	gtk_main();
 
 	return 0;