All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rose via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Rose <83477269+AtariDreams@users.noreply.github.com>,
	Seija Kijin <doremylover123@gmail.com>
Subject: [PATCH] run-command: make async_exit usage consistent
Date: Tue, 03 Jan 2023 17:59:32 +0000	[thread overview]
Message-ID: <pull.1423.git.git.1672768772484.gitgitgadget@gmail.com> (raw)

From: Seija Kijin <doremylover123@gmail.com>

Use async_exit instead of pthread_exit,
and make async_exit inline.

Functions were reordered
so that this would compile.

Luckily, the order remains consistent.

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
---
    run-command: make async_exit usage consistent
    
    Use async_exit instead of pthread_exit, and make async_exit inline.
    
    Finally, make the parameter an unsigned int, because the Win32 API uses
    unsigned int, and for other platforms, we cast to void anyway.
    
    Signed-off-by: Seija Kijin doremylover123@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1423%2FAtariDreams%2Fconsistency-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1423/AtariDreams/consistency-v1
Pull-Request: https://github.com/git/git/pull/1423

 run-command.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/run-command.c b/run-command.c
index 756f1839aab..e1eab4cb69b 100644
--- a/run-command.c
+++ b/run-command.c
@@ -1030,6 +1030,18 @@ static void *run_thread(void *data)
 	return (void *)ret;
 }
 
+int in_async(void)
+{
+	if (!main_thread_set)
+		return 0; /* no asyncs started yet */
+	return !pthread_equal(main_thread, pthread_self());
+}
+
+static inline void NORETURN async_exit(int code)
+{
+	pthread_exit((void *)(intptr_t)code);
+}
+
 static NORETURN void die_async(const char *err, va_list params)
 {
 	report_fn die_message_fn = get_die_message_routine();
@@ -1042,7 +1054,7 @@ static NORETURN void die_async(const char *err, va_list params)
 			close(async->proc_in);
 		if (async->proc_out >= 0)
 			close(async->proc_out);
-		pthread_exit((void *)128);
+		async_exit(128);
 	}
 
 	exit(128);
@@ -1055,18 +1067,6 @@ static int async_die_is_recursing(void)
 	return ret != NULL;
 }
 
-int in_async(void)
-{
-	if (!main_thread_set)
-		return 0; /* no asyncs started yet */
-	return !pthread_equal(main_thread, pthread_self());
-}
-
-static void NORETURN async_exit(int code)
-{
-	pthread_exit((void *)(intptr_t)code);
-}
-
 #else
 
 static struct {
@@ -1112,7 +1112,7 @@ int in_async(void)
 	return process_is_async;
 }
 
-static void NORETURN async_exit(int code)
+static inline void NORETURN async_exit(int code)
 {
 	exit(code);
 }

base-commit: 2b4f5a4e4bb102ac8d967cea653ed753b608193c
-- 
gitgitgadget

             reply	other threads:[~2023-01-03 17:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-03 17:59 Rose via GitGitGadget [this message]
2023-01-08 14:33 ` [PATCH v2] run-command: make async_exit usage consistent Rose via GitGitGadget
2023-01-08 15:13   ` [PATCH v3] run-command: remove async_exit Rose via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1423.git.git.1672768772484.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=83477269+AtariDreams@users.noreply.github.com \
    --cc=doremylover123@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.