Subject: Re: [PATCH v3] simple-ipc: correct ifdefs when NO_PTHREADS is defined

From: Junio C Hamano <[email-masked]>
Date: Fri, 21 May 2021 08:01:59 +0900

"Jeff Hostetler via GitGitGadget" <[email-masked]> writes:

>  Makefile                            | 22 ++++++++++++++++++++--
>  compat/simple-ipc/ipc-shared.c      | 10 +++++++---
>  compat/simple-ipc/ipc-unix-socket.c |  8 ++++++--
>  compat/simple-ipc/ipc-win32.c       |  8 ++++++--
>  contrib/buildsystems/CMakeLists.txt | 10 +++++++++-
>  simple-ipc.h                        |  4 ----
>  6 files changed, 48 insertions(+), 14 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 3a2d3c80a81a..ea4c0a77604d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1687,13 +1687,31 @@ ifdef NO_UNIX_SOCKETS
>  else
>  	LIB_OBJS += unix-socket.o
>  	LIB_OBJS += unix-stream-server.o
> -	LIB_OBJS += compat/simple-ipc/ipc-shared.o
> -	LIB_OBJS += compat/simple-ipc/ipc-unix-socket.o
>  endif
>  
> +# Simple IPC requires threads and platform-specific IPC support.
> +# Only platforms that have both should include these source files
> +# in the build.
> +#
> +# On Windows-based systems, Simple IPC requires threads and Windows
> +# Named Pipes.  These are always available, so Simple IPC support
> +# is optional.

The last part for windows feels funny in that even if they were not
always available, the builder can still choose to compile Simple IPC
support out, hence it is optional (this is true for both Windows and
others).  In other words, "prereqs are always satisified" does not
lead to "hence it is optional".

But let's leave it as-is.  We could rewrite it to "..., so Simple
IPC is always enabled", though.

> +#
> +# On Unix-based systems, Simple IPC requires pthreads and Unix
> +# domain sockets.  So support is only enabled when both are present.

Other than that, looks good to me.

Will queue.