[patch] fix thread test cases for solaris.

Paolo Carlini paolo.carlini@oracle.com
Sun Jan 11 13:50:00 GMT 2009


Hi,
> Ok. Will do.
Thanks for your help on this.
>  In the meantime, any ideas what we should call this
> (disabled by default) --enable option?
> --enable-cxx0x-thread[={rt,yes,no}] or
> --enable-libstdcxx-thread[={rt,yes,no}]?
> --enable-libstdcxx-librt[={yes,no}] i think would also work...
> --enable-nanosleep-sched-yield-clock-gettime???
>   
--enable-libstdcxx-librt seems a very good choice to me. Of course, make
sure to fix / extend the related documentation.
> Hm, looking into this a bit, we currently have this:
>
> #ifdef _GLIBCXX_USE_NANOSLEEP
>         ::nanosleep(&__ts, 0);
> #endif
>
> inside the thread::sleep_* calls, but we should disable the functions
> altogther should we not?
>   
Yes, I think this is a very good idea, the users will like it, a clear
failure at build time.
> #ifdef _GLIBCXX_USE_NANOSLEEP
>         thread::sleep_for(...)
>         {
>         ... ::nanosleep(...);
>         }
> #endif
>
> Then wrap the testcases in a similar manner, or better yet, make
> dg-requires thingies for nanosleep and sched_yield). Actually, there
> already is a dg-requires for nanosleep, but its based on a compile
> only test so making it a link test will fix that, i just have to add
> another for sched_yield.
>   
Yes, exactly.

Note, since we are going to follow the same approach of clock_gettime,
on some targets like linux, nanosleep (thus, sleep_for) will be
unnecessarily disabled by default because the configury will
conservatively assume it may require -lrt. At this stage I think this is
the safest approach, and in any case people seriously experimenting with
those features want librt anyway on linux, because of clock_gettime.

Thanks again,
Paolo.



More information about the Libstdc++ mailing list