This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Eliminate uses of "sleep" in V3 testsuite
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: mark at codesourcery dot com
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 3 Jan 2005 17:21:54 -0600
- Subject: Re: PATCH: Eliminate uses of "sleep" in V3 testsuite
- Organization: Red Hat / Chicago
- References: <200501032135.j03LZH9p025782@sethra.codesourcery.com>
>As discussed previously, use of "sleep" as a synchronization primitive
>in the V3 testsuite is (a) bogus, and (b) slow. This patch implements
>a semaphore class that is used instead. The current implementation of
>the semaphore class uses System V IPC, but there's no reason it needs
>to do that; it could use some other synchronization primitive
>instead. Since these tests already depend on "fork", we're clearly in
>the land of UNIX-like systems.
Sounds good.
Sorry I missed the beginning of this thread. Perhaps you've already
found this, but there has been some commentary about fixing this here:
http://gcc.gnu.org/ml/libstdc++/2004-02/msg00015.html
I thought there was another thread too, but I cannot find it now.
It's nice to see you fixing this correctly! Also, thanks for posting your patch on this list.
>This change cuts about 1 minute off of the V3 test time for me.
yay.
>+ semaphore::semaphore ()
>+ semaphore::~semaphore ()
>+ void
>+ semaphore::wait() {
>+ #ifdef _GLIBCXX_SYSV_SEM
>+ struct sembuf op[1] = {
>+ { 0, -1, SEM_UNDO }
>+ };
>+ if (semop (sem_set_, op, 1) == -1)
>+ throw std::runtime_error ("could not wait for semaphore");
>+ #endif
>+ }
> }; // namespace __gnu_test
Aggggh. Pick a style, any style....
Please think about formatting this code consistently, and hopefully like
the rest of libstdc++ hackers do. Suggestion: see C++STYLE.
ie
foo() not foo ()
something
{
}
not
something {
}
etc etc etc.
You need to update copyrights on files you touched for 2005.
-benjamin