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
b625fdb7
Commit
b625fdb7
authored
May 15, 2003
by
Loren J. Rittle
Committed by
Loren J. Rittle
May 15, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* testsuite/thread/pthread4.cc: Tweak test.
From-SVN: r66817
parent
3b3acc81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
libstdc++-v3/ChangeLog
+4
-0
libstdc++-v3/testsuite/thread/pthread4.cc
+11
-5
No files found.
libstdc++-v3/ChangeLog
View file @
b625fdb7
2003-05-14 Loren J. Rittle <ljrittle@acm.org>
* testsuite/thread/pthread4.cc: Tweak test.
2003-05-13 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/27_io/ios_base/cons/copy_neg.cc: Remove
...
...
libstdc++-v3/testsuite/thread/pthread4.cc
View file @
b625fdb7
...
...
@@ -35,6 +35,8 @@ using namespace std;
static
list
<
string
>
foo
;
static
pthread_mutex_t
fooLock
=
PTHREAD_MUTEX_INITIALIZER
;
static
pthread_cond_t
fooCondOverflow
=
PTHREAD_COND_INITIALIZER
;
static
pthread_cond_t
fooCondUnderflow
=
PTHREAD_COND_INITIALIZER
;
static
unsigned
max_size
=
10
;
#if defined(__CYGWIN__)
static
int
iters
=
10000
;
...
...
@@ -50,11 +52,12 @@ produce (void*)
string
str
(
"test string"
);
pthread_mutex_lock
(
&
fooLock
);
if
(
foo
.
size
()
<
max_size
)
{
foo
.
push_back
(
str
);
num
++
;
}
while
(
foo
.
size
()
>=
max_size
)
pthread_cond_wait
(
&
fooCondOverflow
,
&
fooLock
);
foo
.
push_back
(
str
);
num
++
;
if
(
foo
.
size
()
>=
(
max_size
/
2
))
pthread_cond_signal
(
&
fooCondUnderflow
);
pthread_mutex_unlock
(
&
fooLock
);
}
...
...
@@ -67,12 +70,15 @@ consume (void*)
for
(
int
num
=
0
;
num
<
iters
;
)
{
pthread_mutex_lock
(
&
fooLock
);
while
(
foo
.
size
()
==
0
)
pthread_cond_wait
(
&
fooCondUnderflow
,
&
fooLock
);
while
(
foo
.
size
()
>
0
)
{
string
str
=
foo
.
back
();
foo
.
pop_back
();
num
++
;
}
pthread_cond_signal
(
&
fooCondOverflow
);
pthread_mutex_unlock
(
&
fooLock
);
}
...
...
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