Boost logo

Threads-Devel :

From: Dmitriy Vyukov (dvyukov_at_[hidden])
Date: 2008-05-05 06:02:44


> From: Anthony Williams <anthony <at> justsoftwaresolutions.co.uk>
>
> >> From: Anthony Williams <anthony <at> justsoftwaresolutions.co.uk>
> >>
> >>>> Thanks for the suggestion. Actually, I've been
> >>>> intending to change the implementation to use a BitTestAndSet
> >>>> instruction where it can, so try_lock becomes:
> >>>>
> >>>> return !bit_test_and_set(&active_count,lock_flag_bit);
> >>>>
> >>>> But even then, it might be worth adding a simple non-interlocked read
> >>>> before-hand to check for the flag, and only do the BTS if it's not set.
> >>>>
> >>
> >> I've checked in the BTS-based code, and would be grateful if you could
> >> have a look.
> >
> > Ummm... I'm not sure from where I have to check-out latest version...
> > I've tried this one:
> > http://boost.cvs.sourceforge.net/boost/boost/boost/thread/
> > but it seems that it's wrong place...
>
> Yes, Boost no longer uses sourceforge (or CVS) for the repository. The
> boost Subversion repository trunk is at
> http://svn.boost.org/svn/boost/trunk
>
At first sight it looks OK. I will take a closer look later - if I find
something I will post here.

Btw, this discomforts reading a bit:

#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4127)
#endif
                while(true)
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif

And there is also one 'un-pragmed' while(true) below.

Why you not using 'for(;;)'? msvc and gcc doesn't warn about 'for(;;)'.

 I grep boost 35, and it seems that usage is roughly equal:
'while(true)' - 30, 'for(;;)' - 27 :)

> >> Have you got access to a quad-core or true multiprocessor machine
> >> for testing?
> >
> > Yes, I episodically have access to quad-core Q6600 machine at home :)
> > It acts actually more like 2-core 2-processor machine because of
> > shared L2$. It makes situation even more interesting!
>
> I would be grateful if you could run some tests on your machine.
If it will be compilable with MSVC 2003/2005/2008 project - then no
problem, otherwise it's discussable :)
Ok, your email already in my address-book - we've corresponded already
with you about your article in Overload about boost thread rewrite.

Btw, if you want to measure performance/scalability then you can first
run test with
SetProcessAffinityMask(1) (single core),
then SetProcessAffinityMask(3) (dual-core),
then SetProcessAffinityMask(5) (dual-processor)
and then SetProcessAffinityMask(15) (dual-core, dual-processor)

I usually make so.

Dmitriy V'jukov


Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk