Cygwin: FIFO: start the listen_client thread when duping a reader
Otherwise it doesn't get started until the dup'd fd tries to read, which delays client connections.
This commit is contained in:
		
				
					committed by
					
						 Corinna Vinschen
						Corinna Vinschen
					
				
			
			
				
	
			
			
			
						parent
						
							7b28776d3f
						
					
				
				
					commit
					a7d08b3ecd
				
			| @@ -853,19 +853,20 @@ fhandler_fifo::close () | |||||||
| int | int | ||||||
| fhandler_fifo::dup (fhandler_base *child, int flags) | fhandler_fifo::dup (fhandler_base *child, int flags) | ||||||
| { | { | ||||||
|  |   int ret = -1; | ||||||
|  |   fhandler_fifo *fhf = NULL; | ||||||
|  |  | ||||||
|   if (fhandler_base::dup (child, flags)) |   if (fhandler_base::dup (child, flags)) | ||||||
|     { |     goto out; | ||||||
|       __seterrno (); |  | ||||||
|       return -1; |   fhf = (fhandler_fifo *) child; | ||||||
|     } |  | ||||||
|   fhandler_fifo *fhf = (fhandler_fifo *) child; |  | ||||||
|   if (!DuplicateHandle (GetCurrentProcess (), read_ready, |   if (!DuplicateHandle (GetCurrentProcess (), read_ready, | ||||||
| 			GetCurrentProcess (), &fhf->read_ready, | 			GetCurrentProcess (), &fhf->read_ready, | ||||||
| 			0, true, DUPLICATE_SAME_ACCESS)) | 			0, true, DUPLICATE_SAME_ACCESS)) | ||||||
|     { |     { | ||||||
|       fhf->close (); |       fhf->close (); | ||||||
|       __seterrno (); |       __seterrno (); | ||||||
|       return -1; |       goto out; | ||||||
|     } |     } | ||||||
|   if (!DuplicateHandle (GetCurrentProcess (), write_ready, |   if (!DuplicateHandle (GetCurrentProcess (), write_ready, | ||||||
| 			GetCurrentProcess (), &fhf->write_ready, | 			GetCurrentProcess (), &fhf->write_ready, | ||||||
| @@ -874,7 +875,7 @@ fhandler_fifo::dup (fhandler_base *child, int flags) | |||||||
|       CloseHandle (fhf->read_ready); |       CloseHandle (fhf->read_ready); | ||||||
|       fhf->close (); |       fhf->close (); | ||||||
|       __seterrno (); |       __seterrno (); | ||||||
|       return -1; |       goto out; | ||||||
|     } |     } | ||||||
|   for (int i = 0; i < nhandlers; i++) |   for (int i = 0; i < nhandlers; i++) | ||||||
|     { |     { | ||||||
| @@ -895,13 +896,16 @@ fhandler_fifo::dup (fhandler_base *child, int flags) | |||||||
| 	  CloseHandle (fhf->write_ready); | 	  CloseHandle (fhf->write_ready); | ||||||
| 	  fhf->close (); | 	  fhf->close (); | ||||||
| 	  __seterrno (); | 	  __seterrno (); | ||||||
| 	  return -1; | 	  goto out; | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|   fhf->listen_client_thr = NULL; |   fhf->listen_client_thr = NULL; | ||||||
|   fhf->lct_termination_evt = NULL; |   fhf->lct_termination_evt = NULL; | ||||||
|   fhf->fifo_client_unlock (); |   fhf->fifo_client_unlock (); | ||||||
|   return 0; |   if (!reader || fhf->listen_client ()) | ||||||
|  |     ret = 0; | ||||||
|  | out: | ||||||
|  |   return ret; | ||||||
| } | } | ||||||
|  |  | ||||||
| void | void | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user