mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	add pa_once testing code
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1388 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									d0dcde060b
								
							
						
					
					
						commit
						3ae98db1aa
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -25,6 +25,7 @@
 | 
			
		|||
 | 
			
		||||
#include <pulsecore/thread.h>
 | 
			
		||||
#include <pulsecore/mutex.h>
 | 
			
		||||
#include <pulsecore/once.h>
 | 
			
		||||
#include <pulsecore/log.h>
 | 
			
		||||
#include <pulsecore/core-util.h>
 | 
			
		||||
#include <pulse/xmalloc.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -37,6 +38,12 @@ static int magic_number = 0;
 | 
			
		|||
 | 
			
		||||
#define THREADS_MAX 20
 | 
			
		||||
 | 
			
		||||
static void once_func(void) {
 | 
			
		||||
    pa_log("once!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static pa_once_t once = PA_ONCE_INIT;
 | 
			
		||||
 | 
			
		||||
static void thread_func(void *data) {
 | 
			
		||||
    pa_tls_set(tls, data);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -65,6 +72,8 @@ static void thread_func(void *data) {
 | 
			
		|||
 | 
			
		||||
        pa_mutex_unlock(mutex);
 | 
			
		||||
 | 
			
		||||
        pa_once(&once, once_func);
 | 
			
		||||
 | 
			
		||||
        pa_cond_signal(cond2, 0);
 | 
			
		||||
        
 | 
			
		||||
        pa_log("%s got number %i", (char*) pa_tls_get(tls), k);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue