PATCH: Eliminate uses of "sleep" in V3 testsuite

Benjamin Kosnik bkoz@redhat.com
Mon Jan 3 23:23:00 GMT 2005


>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



More information about the Gcc-patches mailing list