Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
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
riscv-gcc-1
Commits
da18dcc1
Commit
da18dcc1
authored
Dec 08, 2013
by
Jonathan Wakely
Committed by
Jonathan Wakely
Dec 08, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* testsuite/30_threads/async/async.cc: Fix race condition in test.
From-SVN: r205795
parent
7337ddf4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
15 deletions
+14
-15
libstdc++-v3/ChangeLog
+4
-0
libstdc++-v3/testsuite/30_threads/async/async.cc
+10
-15
No files found.
libstdc++-v3/ChangeLog
View file @
da18dcc1
2013-12-08 Jonathan Wakely <jwakely.gcc@gmail.com>
* testsuite/30_threads/async/async.cc: Fix race condition in test.
2013-12-08 Paolo Carlini <paolo.carlini@oracle.com>
2013-12-08 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/20_util/add_const/requirements/explicit_instantiation.cc:
* testsuite/20_util/add_const/requirements/explicit_instantiation.cc:
...
...
libstdc++-v3/testsuite/30_threads/async/async.cc
View file @
da18dcc1
...
@@ -29,23 +29,18 @@
...
@@ -29,23 +29,18 @@
using
namespace
std
;
using
namespace
std
;
struct
work
{
void
work
(
mutex
&
m
)
typedef
void
result_type
;
{
void
operator
()(
mutex
&
m
,
condition_variable
&
cv
)
unique_lock
<
mutex
>
l
(
m
);
{
}
unique_lock
<
mutex
>
l
(
m
);
cv
.
notify_one
();
}
};
void
test01
()
void
test01
()
{
{
mutex
m
;
mutex
m
;
condition_variable
cv
;
unique_lock
<
mutex
>
l
(
m
);
unique_lock
<
mutex
>
l
(
m
);
future
<
void
>
f1
=
async
(
launch
::
async
,
work
(),
ref
(
m
),
ref
(
cv
));
future
<
void
>
f1
=
async
(
launch
::
async
,
&
work
,
ref
(
m
));
cv
.
wait
(
l
);
l
.
unlock
();
// allow async thread to proceed
f1
.
get
();
f1
.
get
();
// wait for it to finish
}
}
void
test02
()
void
test02
()
...
@@ -53,15 +48,15 @@ void test02()
...
@@ -53,15 +48,15 @@ void test02()
bool
test
__attribute__
((
unused
))
=
true
;
bool
test
__attribute__
((
unused
))
=
true
;
mutex
m
;
mutex
m
;
condition_variable
cv
;
unique_lock
<
mutex
>
l
(
m
);
unique_lock
<
mutex
>
l
(
m
);
future
<
void
>
f1
=
async
(
launch
::
async
,
work
(),
ref
(
m
),
ref
(
cv
));
future
<
void
>
f1
=
async
(
launch
::
async
,
&
work
,
ref
(
m
));
std
::
future_status
status
;
std
::
future_status
status
;
status
=
f1
.
wait_for
(
std
::
chrono
::
milliseconds
(
1
));
status
=
f1
.
wait_for
(
std
::
chrono
::
milliseconds
(
1
));
VERIFY
(
status
==
std
::
future_status
::
timeout
);
VERIFY
(
status
==
std
::
future_status
::
timeout
);
status
=
f1
.
wait_until
(
std
::
chrono
::
system_clock
::
now
());
status
=
f1
.
wait_until
(
std
::
chrono
::
system_clock
::
now
());
VERIFY
(
status
==
std
::
future_status
::
timeout
);
VERIFY
(
status
==
std
::
future_status
::
timeout
);
cv
.
wait
(
l
);
l
.
unlock
();
// allow async thread to proceed
f1
.
wait
();
// wait for it to finish
status
=
f1
.
wait_for
(
std
::
chrono
::
milliseconds
(
0
));
status
=
f1
.
wait_for
(
std
::
chrono
::
milliseconds
(
0
));
VERIFY
(
status
==
std
::
future_status
::
ready
);
VERIFY
(
status
==
std
::
future_status
::
ready
);
status
=
f1
.
wait_until
(
std
::
chrono
::
system_clock
::
now
());
status
=
f1
.
wait_until
(
std
::
chrono
::
system_clock
::
now
());
...
...
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