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
5c0fd7b9
Commit
5c0fd7b9
authored
Jun 09, 2012
by
Chris Young
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow disabling pthreads for testing
parent
bb502fa8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
examples/network/fetch.c
+6
-0
No files found.
examples/network/fetch.c
View file @
5c0fd7b9
...
...
@@ -36,7 +36,9 @@ static void *download(void *ptr)
exit:
data
->
finished
=
1
;
#ifndef NO_PTHREADS
pthread_exit
(
&
data
->
ret
);
#endif
}
int
update_cb
(
const
char
*
refname
,
const
git_oid
*
a
,
const
git_oid
*
b
)
...
...
@@ -81,6 +83,9 @@ int fetch(git_repository *repo, int argc, char **argv)
data
.
finished
=
0
;
memset
(
&
stats
,
0
,
sizeof
(
stats
));
#ifdef NO_PTHREADS
download
(
&
data
);
#else
pthread_create
(
&
worker
,
NULL
,
download
,
&
data
);
// Loop while the worker thread is still running. Here we show processed
...
...
@@ -91,6 +96,7 @@ int fetch(git_repository *repo, int argc, char **argv)
usleep
(
10000
);
printf
(
"
\r
Received %d/%d objects in %d bytes"
,
stats
.
processed
,
stats
.
total
,
bytes
);
}
while
(
!
data
.
finished
);
#endif
printf
(
"
\r
Received %d/%d objects in %d bytes
\n
"
,
stats
.
processed
,
stats
.
total
,
bytes
);
// Disconnect the underlying connection to prevent from idling.
...
...
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