This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: *ping* generic atomicity.h
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- To: Phil Edwards <phil at jaj dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Tue, 28 Jan 2003 10:49:14 +1100 (EST)
- Subject: Re: *ping* generic atomicity.h
--- Phil Edwards <phil@jaj.com> wrote: > On Sat, Jan 25, 2003 at 11:05:05AM
+1100, Danny Smith wrote:
> > I have only tested on 3.3. I've just returned from holiday and trunk is
> > throwing some unrelated problems which I have not yet worked through.
>
> Here's what I plan on actually checking in on the trunk, then 3.3 if no
> problems arise.
>
> v3 will compile with this atomicity.h, but of course I can't runtest it.
> Sanity check?
>
OK, with patch and configure for i386-pc-mingw32, libstdc++ builds fine and my
runtests succeed on i586 and i686 for 3_3 branch, trunk bootstrap in progress.
I have been unable to locate an i386 with _ 32-bit Windows installed so I
can't test i386. I don't even know if i386 will even run Windows95 without
crashing on a regular basis.
I have modified testsuite/threads/pthread6.cc for windows as a simple testcase.
Here it is.
Danny
// win32-thread6.cc
// 2002-01-23 Loren J. Rittle <rittle@labs.mot.com> <ljrittle@acm.org>
// Adpated from libstdc++/5444 submitted by markus.breuer@materna.de
//
// Copyright (C) 2002, 2003 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
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// { dg-do run { target *-*-mingw32 } }
// { dg-options "-mthreads" }
#include <string>
#include <map>
#include <vector>
#include <process.h>
#if __GTHREADS
const int max_thread_count = 8;
const int loops = 100000;
const char* my_default = "Hallo Welt!";
const int upper_limit = 2500;
const int lower_limit = 1000;
typedef char charT;
typedef std::string String;
typedef String MyType;
void
thread_main (void*)
{
typedef std::map<unsigned int,MyType> Map;
typedef Map::value_type Value_Pair;
Map myMap;
for (int loop = 0; loop < loops; loop++)
{
String& str = myMap[loop];
str.append (my_default);
myMap.insert (Value_Pair (loop, str));
if (myMap.size () > upper_limit)
{
while (myMap.size () > lower_limit)
{
Map::iterator it = myMap.begin ();
myMap.erase (it);
}
}
}
}
int
main (void)
{
for (int i = 0; i < max_thread_count; i++)
_beginthread (thread_main, 0, NULL);
return 0;
}
#else
int main (void) {}
#endif
http://movies.yahoo.com.au - Yahoo! Movies
- What's on at your local cinema?