This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/29118] [4.2 Regression] Timeouts in libstdc++, libjava and libgomp testsuites
- From: "bkoz at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Oct 2006 09:48:43 -0000
- Subject: [Bug libstdc++/29118] [4.2 Regression] Timeouts in libstdc++, libjava and libgomp testsuites
- References: <bug-29118-276@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #15 from bkoz at gcc dot gnu dot org 2006-10-06 09:48 -------
// try this simpler code.
#include <stdexcept>
#include <ext/concurrence.h>
namespace
{
__gnu_cxx::__mutex test_mutex;
unsigned int i;
} // anonymous namespace
void* add(void*)
{
__gnu_cxx::__scoped_lock sentry(test_mutex);
{
++i; // break here
}
return 0;
}
void
check_thread_create(int ret)
{
if (ret != 0)
{
char buf[10];
sprintf(buf, "%u", ret);
std::string error("pthread_create failed: ");
error += buf;
error += strerror(ret);
throw std::runtime_error(error);
}
}
int main()
{
pthread_t id1;
pthread_t id2;
check_thread_create(pthread_create(&id1, NULL, add, 0));
check_thread_create(pthread_create(&id2, NULL, add, 0));
pthread_join(id1, NULL);
pthread_join(id2, NULL);
return 0;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29118