]>
Commit | Line | Data |
---|---|---|
ddd69607 LR |
1 | // 2002-01-23 Loren J. Rittle <rittle@labs.mot.com> <ljrittle@acm.org> |
2 | // Adpated from libstdc++/5347 submitted by markus.breuer@materna.de | |
3 | // | |
818ab71a | 4 | // Copyright (C) 2002-2016 Free Software Foundation, Inc. |
ddd69607 LR |
5 | // |
6 | // This file is part of the GNU ISO C++ Library. This library is free | |
7 | // software; you can redistribute it and/or modify it under the | |
8 | // terms of the GNU General Public License as published by the | |
748086b7 | 9 | // Free Software Foundation; either version 3, or (at your option) |
ddd69607 LR |
10 | // any later version. |
11 | // | |
12 | // This library is distributed in the hope that it will be useful, | |
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | // GNU General Public License for more details. | |
16 | // | |
17 | // You should have received a copy of the GNU General Public License along | |
748086b7 JJ |
18 | // with this library; see the file COPYING3. If not see |
19 | // <http://www.gnu.org/licenses/>. | |
ddd69607 | 20 | |
37d13ae6 | 21 | // { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } |
71c54f8e | 22 | // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* } } |
ddd69607 LR |
23 | |
24 | #include <sstream> | |
1769232d | 25 | #include <pthread.h> |
ddd69607 | 26 | |
ddd69607 LR |
27 | const int max_thread_count = 2; |
28 | const int max_loop_count = 1000000; | |
29 | ||
30 | void* | |
31 | thread_main (void *) | |
32 | { | |
33 | for (int i = 0; i < max_loop_count; i++) | |
34 | std::ostringstream oss; | |
35 | ||
36 | return 0; | |
37 | } | |
38 | ||
39 | int | |
40 | main() | |
41 | { | |
42 | pthread_t tid[max_thread_count]; | |
43 | ||
87bd0274 | 44 | #if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500 |
ddd69607 LR |
45 | pthread_setconcurrency (max_thread_count); |
46 | #endif | |
47 | ||
48 | for (int i = 0; i < max_thread_count; i++) | |
8fc81078 | 49 | pthread_create (&tid[i], 0, thread_main, 0); |
ddd69607 LR |
50 | |
51 | for (int i = 0; i < max_thread_count; i++) | |
8fc81078 | 52 | pthread_join (tid[i], 0); |
ddd69607 LR |
53 | |
54 | return 0; | |
55 | } |