Skip to content

Commit d6fdcfb

Browse files
dschoGit for Windows Build Agent
authored andcommitted
fixup! win32/pthread: avoid name clashes with winpthread
Part of the series that drops the vendored `mimalloc` from this fork; the rationale (no measurable speedup over the platform allocator on any of Windows, macOS, or Linux) is in the second commit of the series and the PR description. The original commit was a preparation step for vendoring `mimalloc` in (which forces C11 mode under mingw-w64 GCC and so implicitly links libwinpthread, clashing with Git's own emulation). With `mimalloc` gone the rename is no longer needed, so this revert restores the plain `pthread_create` / `pthread_self` names. The `fixup!` subject is so the next rebase against an upstream Git that already lacks the target commit autosquashes this revert into it, dropping the original cleanly. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent f587c33 commit d6fdcfb

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

compat/win32/pthread.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ static unsigned __stdcall win32_start_routine(void *arg)
2121
return 0;
2222
}
2323

24-
int win32_pthread_create(pthread_t *thread, const void *attr UNUSED,
25-
void *(*start_routine)(void *), void *arg)
24+
int pthread_create(pthread_t *thread, const void *attr UNUSED,
25+
void *(*start_routine)(void *), void *arg)
2626
{
2727
thread->arg = arg;
2828
thread->start_routine = start_routine;
@@ -53,7 +53,7 @@ int win32_pthread_join(pthread_t *thread, void **value_ptr)
5353
}
5454
}
5555

56-
pthread_t win32_pthread_self(void)
56+
pthread_t pthread_self(void)
5757
{
5858
pthread_t t = { NULL };
5959
t.tid = GetCurrentThreadId();

compat/win32/pthread.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ typedef struct {
4949
DWORD tid;
5050
} pthread_t;
5151

52-
int win32_pthread_create(pthread_t *thread, const void *unused,
53-
void *(*start_routine)(void*), void *arg);
54-
#define pthread_create win32_pthread_create
52+
int pthread_create(pthread_t *thread, const void *unused,
53+
void *(*start_routine)(void*), void *arg);
5554

5655
/*
5756
* To avoid the need of copying a struct, we use small macro wrapper to pass
@@ -62,8 +61,7 @@ int win32_pthread_create(pthread_t *thread, const void *unused,
6261
int win32_pthread_join(pthread_t *thread, void **value_ptr);
6362

6463
#define pthread_equal(t1, t2) ((t1).tid == (t2).tid)
65-
pthread_t win32_pthread_self(void);
66-
#define pthread_self win32_pthread_self
64+
pthread_t pthread_self(void);
6765

6866
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
6967
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,

0 commit comments

Comments
 (0)