Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
1b4e29b7
Commit
1b4e29b7
authored
Jun 07, 2014
by
Philip Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
React to review feedback
parent
fb591767
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
18 deletions
+26
-18
src/thread-utils.h
+8
-13
src/win32/pthread.c
+5
-4
src/win32/pthread.h
+13
-1
No files found.
src/thread-utils.h
View file @
1b4e29b7
...
...
@@ -40,21 +40,16 @@ typedef git_atomic git_atomic_ssize;
#ifdef GIT_THREADS
#if defined(GIT_WIN32)
#define git_thread git_win32_thread
#define git_thread_create(thread, attr, start_routine, arg) \
git_win32__thread_create(thread, attr, start_routine, arg)
#define git_thread_join(thread_ptr, status) \
git_win32__thread_join(thread_ptr, status)
#if !defined(GIT_WIN32)
#else
typedef
struct
{
pthread_t
thread
;
}
git_thread
;
#define git_thread pthread_t
#define git_thread_create(thread, attr, start_routine, arg) \
pthread_create(thread, attr, start_routine, arg)
#define git_thread_join(thread_ptr, status) \
pthread_join(*(thread_ptr), status)
#define git_thread_create(git_thread_ptr, attr, start_routine, arg) \
pthread_create(&(git_thread_ptr)->thread, attr, start_routine, arg)
#define git_thread_join(git_thread_ptr, status) \
pthread_join((git_thread_ptr)->thread, status)
#endif
...
...
src/win32/pthread.c
View file @
1b4e29b7
...
...
@@ -18,7 +18,7 @@ static DWORD WINAPI git_win32__threadproc(LPVOID lpParameter)
{
git_win32_thread
*
thread
=
lpParameter
;
thread
->
value
=
thread
->
proc
(
thread
->
value
);
thread
->
result
=
thread
->
proc
(
thread
->
param
);
return
CLEAN_THREAD_EXIT
;
}
...
...
@@ -31,7 +31,8 @@ int git_win32__thread_create(
{
GIT_UNUSED
(
attr
);
thread
->
value
=
arg
;
thread
->
result
=
NULL
;
thread
->
param
=
arg
;
thread
->
proc
=
start_routine
;
thread
->
thread
=
CreateThread
(
NULL
,
0
,
git_win32__threadproc
,
thread
,
0
,
NULL
);
...
...
@@ -57,11 +58,11 @@ int git_win32__thread_join(
* then we don't have a return value to give back to the caller. */
if
(
exit
!=
CLEAN_THREAD_EXIT
)
{
assert
(
false
);
thread
->
value
=
NULL
;
thread
->
result
=
NULL
;
}
if
(
value_ptr
)
*
value_ptr
=
thread
->
value
;
*
value_ptr
=
thread
->
result
;
CloseHandle
(
thread
->
thread
);
return
0
;
...
...
src/win32/pthread.h
View file @
1b4e29b7
...
...
@@ -19,7 +19,8 @@
typedef
struct
{
HANDLE
thread
;
void
*
(
*
proc
)(
void
*
);
void
*
value
;
void
*
param
;
void
*
result
;
}
git_win32_thread
;
typedef
int
pthread_mutexattr_t
;
...
...
@@ -51,6 +52,17 @@ int git_win32__thread_join(
git_win32_thread
*
,
void
**
);
#ifdef GIT_THREADS
typedef
git_win32_thread
git_thread
;
#define git_thread_create(git_thread_ptr, attr, start_routine, arg) \
git_win32__thread_create(git_thread_ptr, attr, start_routine, arg)
#define git_thread_join(git_thread_ptr, status) \
git_win32__thread_join(git_thread_ptr, status)
#endif
int
pthread_mutex_init
(
pthread_mutex_t
*
GIT_RESTRICT
mutex
,
const
pthread_mutexattr_t
*
GIT_RESTRICT
mutexattr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment