mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	dlsym: fix again snd_dlpath()
There is double lock in 8d866e4cd8 .
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
			
			
This commit is contained in:
		
							parent
							
								
									515b336801
								
							
						
					
					
						commit
						e9a36ca224
					
				
					 1 changed files with 26 additions and 9 deletions
				
			
		
							
								
								
									
										35
									
								
								src/dlmisc.c
									
										
									
									
									
								
							
							
						
						
									
										35
									
								
								src/dlmisc.c
									
										
									
									
									
								
							| 
						 | 
					@ -42,20 +42,20 @@ static char *snd_libdir_origin = NULL;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_LIBPTHREAD
 | 
					#ifdef HAVE_LIBPTHREAD
 | 
				
			||||||
static pthread_mutex_t snd_dlobj_mutex = PTHREAD_MUTEX_INITIALIZER;
 | 
					static pthread_mutex_t snd_dlpath_mutex = PTHREAD_MUTEX_INITIALIZER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void snd_dlobj_lock(void)
 | 
					static inline void snd_dlpath_lock(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pthread_mutex_lock(&snd_dlobj_mutex);
 | 
						pthread_mutex_lock(&snd_dlpath_mutex);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void snd_dlobj_unlock(void)
 | 
					static inline void snd_dlpath_unlock(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pthread_mutex_unlock(&snd_dlobj_mutex);
 | 
						pthread_mutex_unlock(&snd_dlpath_mutex);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
static inline void snd_dlobj_lock(void) {}
 | 
					static inline void snd_dlpath_lock(void) {}
 | 
				
			||||||
static inline void snd_dlobj_unlock(void) {}
 | 
					static inline void snd_dlpath_unlock(void) {}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -71,7 +71,7 @@ int snd_dlpath(char *path, size_t path_len, const char *name)
 | 
				
			||||||
#ifdef HAVE_LIBDL
 | 
					#ifdef HAVE_LIBDL
 | 
				
			||||||
#ifdef __GLIBC__
 | 
					#ifdef __GLIBC__
 | 
				
			||||||
	static int plugin_dir_set = 0;
 | 
						static int plugin_dir_set = 0;
 | 
				
			||||||
	snd_dlobj_lock();
 | 
						snd_dlpath_lock();
 | 
				
			||||||
	if (!plugin_dir_set) {
 | 
						if (!plugin_dir_set) {
 | 
				
			||||||
		struct link_map *links;
 | 
							struct link_map *links;
 | 
				
			||||||
		Dl_info info;
 | 
							Dl_info info;
 | 
				
			||||||
| 
						 | 
					@ -85,7 +85,7 @@ int snd_dlpath(char *path, size_t path_len, const char *name)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		plugin_dir_set = 1;
 | 
							plugin_dir_set = 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	snd_dlobj_unlock();
 | 
						snd_dlpath_unlock();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	if (snd_libdir_origin)
 | 
						if (snd_libdir_origin)
 | 
				
			||||||
| 
						 | 
					@ -287,6 +287,23 @@ struct dlobj_cache {
 | 
				
			||||||
	struct list_head list;
 | 
						struct list_head list;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef HAVE_LIBPTHREAD
 | 
				
			||||||
 | 
					static pthread_mutex_t snd_dlobj_mutex = PTHREAD_MUTEX_INITIALIZER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline void snd_dlobj_lock(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						pthread_mutex_lock(&snd_dlobj_mutex);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline void snd_dlobj_unlock(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						pthread_mutex_unlock(&snd_dlobj_mutex);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					static inline void snd_dlobj_lock(void) {}
 | 
				
			||||||
 | 
					static inline void snd_dlobj_unlock(void) {}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static LIST_HEAD(pcm_dlobj_list);
 | 
					static LIST_HEAD(pcm_dlobj_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct dlobj_cache *
 | 
					static struct dlobj_cache *
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue