send-pack.c: move async's #ifdef NO_PTHREADS back to run-command.c
On systems that do not support multithread, start_async() is
implemented with fork(). This implementation details unfortunately
leak out at least in send-pack.c [1].
To keep the code base clean of NO_PTHREADS, move the this #ifdef back
to run-command.c. The new wrapper function async_with_fork() at least
helps suggest that this special "close()" is related to async in fork
mode.
[1] 09c9957cf7 (send-pack: avoid deadlock when pack-object dies early
- 2011-04-25)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
10bc232d0f
commit
c0e40a2d66
@ -203,9 +203,8 @@ static int receive_status(int in, struct ref *refs)
|
||||
static int sideband_demux(int in, int out, void *data)
|
||||
{
|
||||
int *fd = data, ret;
|
||||
#ifdef NO_PTHREADS
|
||||
close(fd[1]);
|
||||
#endif
|
||||
if (async_with_fork())
|
||||
close(fd[1]);
|
||||
ret = recv_sideband("send-pack", fd[0], out);
|
||||
close(out);
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user