unlimited select() timeout
mpd sets a 1s select() timeout for no reason. This makes mpd wake up the CPU, consume some cycles just to see there is nothing to do. We can save that by specifying NULL instead of a timeout. git-svn-id: https://svn.musicpd.org/mpd/trunk@7212 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
		 Max Kellermann
					Max Kellermann
				
			
				
					committed by
					
						 Eric Wong
						Eric Wong
					
				
			
			
				
	
			
			
			 Eric Wong
						Eric Wong
					
				
			
						parent
						
							d78ddd1e50
						
					
				
				
					commit
					f9e317ccbd
				
			| @@ -478,14 +478,11 @@ int doIOForInterfaces(void) | |||||||
| 	fd_set rfds; | 	fd_set rfds; | ||||||
| 	fd_set wfds; | 	fd_set wfds; | ||||||
| 	fd_set efds; | 	fd_set efds; | ||||||
| 	struct timeval tv; | 	struct timeval tv, *tvp = NULL; | ||||||
| 	int i; | 	int i; | ||||||
| 	int selret; | 	int selret; | ||||||
| 	int fdmax; | 	int fdmax; | ||||||
|  |  | ||||||
| 	tv.tv_sec = 1; |  | ||||||
| 	tv.tv_usec = 0; |  | ||||||
|  |  | ||||||
| 	while (1) { | 	while (1) { | ||||||
| 		fdmax = 0; | 		fdmax = 0; | ||||||
|  |  | ||||||
| @@ -495,7 +492,7 @@ int doIOForInterfaces(void) | |||||||
|  |  | ||||||
| 		registered_IO_add_fds(&fdmax, &rfds, &wfds, &efds); | 		registered_IO_add_fds(&fdmax, &rfds, &wfds, &efds); | ||||||
|  |  | ||||||
| 		selret = select(fdmax + 1, &rfds, &wfds, &efds, &tv); | 		selret = select(fdmax + 1, &rfds, &wfds, &efds, tvp); | ||||||
|  |  | ||||||
| 		if (selret < 0 && errno == EINTR) | 		if (selret < 0 && errno == EINTR) | ||||||
| 			break; | 			break; | ||||||
| @@ -530,6 +527,7 @@ int doIOForInterfaces(void) | |||||||
|  |  | ||||||
| 		tv.tv_sec = 0; | 		tv.tv_sec = 0; | ||||||
| 		tv.tv_usec = 0; | 		tv.tv_usec = 0; | ||||||
|  | 		tvp = &tv; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return 1; | 	return 1; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user