Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
111301a0
Commit
111301a0
authored
Aug 08, 2014
by
Philip Withnall
Committed by
Olivier Crête
Aug 21, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: Fix race conditions in test-thread
As found by tsan.
parent
859fcb9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
tests/test-thread.c
tests/test-thread.c
+14
-14
No files found.
tests/test-thread.c
View file @
111301a0
...
@@ -48,11 +48,11 @@
...
@@ -48,11 +48,11 @@
GMainLoop
*
error_loop
;
GMainLoop
*
error_loop
;
gint
global_lagent_cands
=
0
;
volatile
gint
global_lagent_cands
=
0
;
gint
global_ragent_cands
=
0
;
volatile
gint
global_ragent_cands
=
0
;
gint
global_lagent_buffers
=
0
;
volatile
gint
global_lagent_buffers
=
0
;
gint
global_ragent_buffers
=
0
;
volatile
gint
global_ragent_buffers
=
0
;
static
gboolean
timer_cb
(
gpointer
pointer
)
static
gboolean
timer_cb
(
gpointer
pointer
)
{
{
...
@@ -131,7 +131,8 @@ static void cb_candidate_gathering_done(NiceAgent *agent, guint stream_id, gpoin
...
@@ -131,7 +131,8 @@ static void cb_candidate_gathering_done(NiceAgent *agent, guint stream_id, gpoin
static
void
cb_nice_recv
(
NiceAgent
*
agent
,
guint
stream_id
,
guint
component_id
,
guint
len
,
gchar
*
buf
,
gpointer
user_data
)
static
void
cb_nice_recv
(
NiceAgent
*
agent
,
guint
stream_id
,
guint
component_id
,
guint
len
,
gchar
*
buf
,
gpointer
user_data
)
{
{
gchar
data
[
10
];
gchar
data
[
10
];
gint
*
count
=
NULL
;
volatile
gint
*
count
=
NULL
;
gint
count_val
;
if
(
GPOINTER_TO_UINT
(
user_data
)
==
1
)
if
(
GPOINTER_TO_UINT
(
user_data
)
==
1
)
count
=
&
global_lagent_buffers
;
count
=
&
global_lagent_buffers
;
...
@@ -140,21 +141,20 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id,
...
@@ -140,21 +141,20 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id,
else
else
g_error
(
"Invalid agent ?"
);
g_error
(
"Invalid agent ?"
);
if
(
*
count
==
-
1
)
count_val
=
g_atomic_int_get
(
count
);
if
(
count_val
==
10
)
return
;
return
;
g_assert
(
len
==
10
);
g_assert
(
len
==
10
);
memset
(
data
,
*
count
+
'1'
,
10
);
memset
(
data
,
count_val
+
'1'
,
10
);
g_assert
(
memcmp
(
buf
,
data
,
10
)
==
0
);
g_assert
(
memcmp
(
buf
,
data
,
10
)
==
0
);
(
*
count
)
++
;
g_atomic_int_inc
(
count
)
;
if
(
*
count
==
10
)
if
(
g_atomic_int_get
(
&
global_ragent_buffers
)
==
10
&&
*
count
=
-
1
;
g_atomic_int_get
(
&
global_lagent_buffers
)
==
10
)
if
(
global_ragent_buffers
==
-
1
&&
global_lagent_buffers
==
-
1
)
g_main_loop_quit
(
error_loop
);
g_main_loop_quit
(
error_loop
);
}
}
...
@@ -335,8 +335,8 @@ int main (void)
...
@@ -335,8 +335,8 @@ int main (void)
g_thread_join
(
rthread
);
g_thread_join
(
rthread
);
/* note: verify that correct number of local candidates were reported */
/* note: verify that correct number of local candidates were reported */
g_assert
(
g
lobal_lagent_cands
==
1
);
g_assert
(
g
_atomic_int_get
(
&
global_lagent_cands
)
==
1
);
g_assert
(
g
lobal_ragent_cands
==
1
);
g_assert
(
g
_atomic_int_get
(
&
global_ragent_cands
)
==
1
);
g_object_unref
(
lagent
);
g_object_unref
(
lagent
);
g_object_unref
(
ragent
);
g_object_unref
(
ragent
);
...
...
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