From 189cd5056db36dc477e1673f75f2eccf3be4056b Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Sun, 12 Mar 2006 10:34:36 +0000 Subject: 10097.cc: Fix race condition. 2006-03-12 Howard Hinnant * testsuite/27_io/basic_filebuf/underflow/char/10097.cc: Fix race condition. * testsuite/27_io/objects/char/9661-1.cc: Likewise. * testsuite/27_io/objects/wchar_t/9661-1.cc: Likewise. From-SVN: r111978 --- libstdc++-v3/ChangeLog | 7 +++++++ .../testsuite/27_io/basic_filebuf/underflow/char/10097.cc | 13 ++++++++----- libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc | 14 ++++++++------ libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc | 14 ++++++++------ 4 files changed, 31 insertions(+), 17 deletions(-) (limited to 'libstdc++-v3') diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 218b225..d29909a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2006-03-12 Howard Hinnant + + * testsuite/27_io/basic_filebuf/underflow/char/10097.cc: + Fix race condition. + * testsuite/27_io/objects/char/9661-1.cc: Likewise. + * testsuite/27_io/objects/wchar_t/9661-1.cc: Likewise. + 2006-03-10 Paolo Carlini * include/tr1/cmath: Add atan2 and pow bits; add using declarations. diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc index 33c7230..345a664 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/char/10097.cc @@ -3,7 +3,8 @@ // 2001-05-21 Benjamin Kosnik -// Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -61,7 +62,7 @@ void test16() VERIFY( false ); } - semaphore s1; + semaphore s1, s2; int fval = fork(); if (fval == -1) { @@ -72,11 +73,12 @@ void test16() { filebuf fbout; fbout.open(name, ios_base::in|ios_base::out); - VERIFY ( fbout.is_open() ); + VERIFY( fbout.is_open() ); fbout.sputn("0123456789", 10); fbout.pubsync(); - s1.wait (); + s1.wait(); fbout.close(); + s2.signal(); exit(0); } @@ -97,7 +99,8 @@ void test16() } fb.close(); - s1.signal (); + s1.signal(); + s2.wait(); } int main() diff --git a/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc b/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc index b6b8b3b..6497f62 100644 --- a/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc +++ b/libstdc++-v3/testsuite/27_io/objects/char/9661-1.cc @@ -3,7 +3,7 @@ // 2003-04-30 Petur Runolfsson -// Copyright (C) 2003, 2005 Free Software Foundation, Inc. +// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -57,14 +57,15 @@ void test01() VERIFY (file != NULL); fputs("Whatever\n", file); fflush(file); - s1.signal (); - s2.wait (); + s1.signal(); + s2.wait(); fclose(file); + s1.signal(); exit(0); } - + freopen(name, "r", stdin); - s1.wait (); + s1.wait(); int c1 = fgetc(stdin); VERIFY( c1 != EOF ); @@ -82,7 +83,8 @@ void test01() int c5 = cin.rdbuf()->sgetc(); VERIFY( c5 != EOF ); VERIFY( c5 == c4 ); - s2.signal (); + s2.signal(); + s1.wait(); } int main() diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc index 130af01..5b3c231 100644 --- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc +++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc @@ -3,7 +3,7 @@ // 2003-04-30 Petur Runolfsson -// Copyright (C) 2003, 2005 Free Software Foundation, Inc. +// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -56,14 +56,15 @@ void test01() FILE* file = fopen(name, "w"); fputs("Whatever\n", file); fflush(file); - s1.signal (); - s2.wait (); + s1.signal(); + s2.wait(); fclose(file); + s1.signal(); exit(0); } - + freopen(name, "r", stdin); - s1.wait (); + s1.wait(); wint_t c1 = fgetwc(stdin); VERIFY( c1 != WEOF ); @@ -81,7 +82,8 @@ void test01() wint_t c5 = wcin.rdbuf()->sgetc(); VERIFY( c5 != WEOF ); VERIFY( c5 == c4 ); - s2.signal (); + s2.signal(); + s1.wait(); } int main() -- cgit v1.1