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
b37359aa
Commit
b37359aa
authored
Aug 21, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix warnings when compiling without threads
parent
fe372740
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
src/sortedcache.c
+2
-0
tests-clar/threads/refdb.c
+15
-4
No files found.
src/sortedcache.c
View file @
b37359aa
...
...
@@ -176,6 +176,8 @@ bool git_sortedcache_out_of_date(git_sortedcache *sc)
/* lock sortedcache while making modifications */
int
git_sortedcache_lock
(
git_sortedcache
*
sc
)
{
GIT_UNUSED
(
sc
);
/* to prevent warning when compiled w/o threads */
if
(
git_mutex_lock
(
&
sc
->
lock
)
<
0
)
{
giterr_set
(
GITERR_OS
,
"Unable to acquire mutex lock"
);
return
-
1
;
...
...
tests-clar/threads/refdb.c
View file @
b37359aa
...
...
@@ -23,9 +23,7 @@ static void *iterate_refs(void *arg)
{
git_reference_iterator
*
i
;
git_reference
*
ref
;
int
count
=
0
,
*
id
=
arg
;
usleep
(
THREADS
-
*
id
);
int
count
=
0
;
cl_git_pass
(
git_reference_iterator_new
(
&
i
,
g_repo
));
...
...
@@ -75,12 +73,19 @@ void test_threads_refdb__iterator(void)
for
(
t
=
0
;
t
<
THREADS
;
++
t
)
{
id
[
t
]
=
t
;
#ifdef GIT_THREADS
cl_git_pass
(
git_thread_create
(
&
th
[
t
],
NULL
,
iterate_refs
,
&
id
[
t
]));
#else
th
[
t
]
=
t
;
iterate_refs
(
&
id
[
t
]);
#endif
}
#ifdef GIT_THREADS
for
(
t
=
0
;
t
<
THREADS
;
++
t
)
{
cl_git_pass
(
git_thread_join
(
th
[
t
],
NULL
));
}
#endif
memset
(
th
,
0
,
sizeof
(
th
));
}
...
...
@@ -124,7 +129,6 @@ static void *delete_refs(void *arg)
name
,
sizeof
(
name
),
"refs/heads/thread-%03d-%02d"
,
(
*
id
)
&
~
0x3
,
i
);
if
(
!
git_reference_lookup
(
&
ref
,
g_repo
,
name
))
{
fprintf
(
stderr
,
"deleting %s
\n
"
,
name
);
cl_git_pass
(
git_reference_delete
(
ref
));
git_reference_delete
(
ref
);
}
...
...
@@ -180,9 +184,15 @@ void test_threads_refdb__edit_while_iterate(void)
}
id
[
t
]
=
t
;
#ifdef GIT_THREADS
cl_git_pass
(
git_thread_create
(
&
th
[
t
],
NULL
,
fn
,
&
id
[
t
]));
#else
th
[
t
]
=
t
;
fn
(
&
id
[
t
]);
#endif
}
#ifdef GIT_THREADS
for
(
t
=
0
;
t
<
THREADS
;
++
t
)
{
cl_git_pass
(
git_thread_join
(
th
[
t
],
NULL
));
}
...
...
@@ -197,4 +207,5 @@ void test_threads_refdb__edit_while_iterate(void)
for
(
t
=
0
;
t
<
THREADS
;
++
t
)
{
cl_git_pass
(
git_thread_join
(
th
[
t
],
NULL
));
}
#endif
}
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