mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	cleanup priority management in main loop
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@107 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									68eb5dd248
								
							
						
					
					
						commit
						6f0936f6d0
					
				
					 2 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
					@ -226,7 +226,7 @@ static void glib_time_restart(struct pa_time_event*e, const struct timeval *tv)
 | 
				
			||||||
        e->source = g_timeout_source_new(msec_diff(tv, &now));
 | 
					        e->source = g_timeout_source_new(msec_diff(tv, &now));
 | 
				
			||||||
        assert(e->source);
 | 
					        assert(e->source);
 | 
				
			||||||
        g_source_set_callback(e->source, time_cb, e, NULL);
 | 
					        g_source_set_callback(e->source, time_cb, e, NULL);
 | 
				
			||||||
        g_source_set_priority(e->source, G_PRIORITY_HIGH);
 | 
					        g_source_set_priority(e->source, G_PRIORITY_DEFAULT);
 | 
				
			||||||
        g_source_attach(e->source, e->mainloop->glib_main_context);
 | 
					        g_source_attach(e->source, e->mainloop->glib_main_context);
 | 
				
			||||||
    } else
 | 
					    } else
 | 
				
			||||||
        e->source = NULL;
 | 
					        e->source = NULL;
 | 
				
			||||||
| 
						 | 
					@ -312,7 +312,7 @@ static void glib_defer_enable(struct pa_defer_event *e, int b) {
 | 
				
			||||||
        assert(e->source);
 | 
					        assert(e->source);
 | 
				
			||||||
        g_source_set_callback(e->source, idle_cb, e, NULL);
 | 
					        g_source_set_callback(e->source, idle_cb, e, NULL);
 | 
				
			||||||
        g_source_attach(e->source, e->mainloop->glib_main_context);
 | 
					        g_source_attach(e->source, e->mainloop->glib_main_context);
 | 
				
			||||||
        g_source_set_priority(e->source, G_PRIORITY_HIGH_IDLE);
 | 
					        g_source_set_priority(e->source, G_PRIORITY_HIGH);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@
 | 
				
			||||||
#include <sys/time.h>
 | 
					#include <sys/time.h>
 | 
				
			||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*#define GLIB_MAIN_LOOP*/
 | 
					#define GLIB_MAIN_LOOP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef GLIB_MAIN_LOOP
 | 
					#ifdef GLIB_MAIN_LOOP
 | 
				
			||||||
#include <glib.h>
 | 
					#include <glib.h>
 | 
				
			||||||
| 
						 | 
					@ -13,10 +13,13 @@ static GMainLoop* glib_main_loop = NULL;
 | 
				
			||||||
#include "mainloop.h"
 | 
					#include "mainloop.h"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static struct pa_defer_event *de;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void iocb(struct pa_mainloop_api*a, struct pa_io_event *e, int fd, enum pa_io_event_flags f, void *userdata) {
 | 
					static void iocb(struct pa_mainloop_api*a, struct pa_io_event *e, int fd, enum pa_io_event_flags f, void *userdata) {
 | 
				
			||||||
    unsigned char c;
 | 
					    unsigned char c;
 | 
				
			||||||
    read(fd, &c, sizeof(c));
 | 
					    read(fd, &c, sizeof(c));
 | 
				
			||||||
    fprintf(stderr, "IO EVENT: %c\n", c < 32 ? '.' : c);
 | 
					    fprintf(stderr, "IO EVENT: %c\n", c < 32 ? '.' : c);
 | 
				
			||||||
 | 
					    a->defer_enable(de, 1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void dcb(struct pa_mainloop_api*a, struct pa_defer_event *e, void *userdata) {
 | 
					static void dcb(struct pa_mainloop_api*a, struct pa_defer_event *e, void *userdata) {
 | 
				
			||||||
| 
						 | 
					@ -37,7 +40,6 @@ static void tcb(struct pa_mainloop_api*a, struct pa_time_event *e, const struct
 | 
				
			||||||
int main(int argc, char *argv[]) {
 | 
					int main(int argc, char *argv[]) {
 | 
				
			||||||
    struct pa_mainloop_api *a;
 | 
					    struct pa_mainloop_api *a;
 | 
				
			||||||
    struct pa_io_event *ioe;
 | 
					    struct pa_io_event *ioe;
 | 
				
			||||||
    struct pa_defer_event *de;
 | 
					 | 
				
			||||||
    struct pa_time_event *te;
 | 
					    struct pa_time_event *te;
 | 
				
			||||||
    struct timeval tv;
 | 
					    struct timeval tv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue