Boost logo

Boost Users :

Subject: Re: [Boost-users] [Thread] Not able to compile a program with Thread library on ARM
From: Rudi Dittrich (rudid_at_[hidden])
Date: 2008-09-26 04:18:19


> > Dear all,
> >
> > I've got the following problem: I want to use the boost threading
> library provided in version 1.36 on an arm (imx31) based evaluation board with
> MontaVista linux and g++ version 4.2.0 on it.
> > When I try to compile the following example with my arm-g++ compiler
> >
>
> I ran into this same problem on ARM. Sounds like you've found the
> fix, but FYI: I just made Boost short-circuit the tests for
> GCC-specific atomic code on ARM, and use the generic pthreads versions
> instead. See the attached patch.
>

Hi Matthew,

I compiled boost thread with your patch but I got lots of compilation errors. Maybe I haven't set-up my boost environment
correctly. So could you please give me some further details / advices on your compilation setting (flags, etc.) and how I have to compile the thread library.
I've added a patch which includes two specialized implementations of 'atomic_count' and 'sp_counted_base' for ARMv6 and higher which are used by shared_ptr. In my mind, this could be an optimal implementation for these architectures as I used LDREX and STREX instructions within each atomic operation. This means, that I load (using LDREX) a particular value from memory, operate on it, e.g.: increment the value, and write it back to the memory with STREX. During this computation the system assumes that no one else writes to this address. This is a very optimistic approach and does not block the external bus of the processor. Thus, others could continue with their computations which could possibly lead to a performance gain. STREX indicates whether someone has changed the value of this address during our atomic operation. If so, we have to jump back to the beginning of the operation and start the operation again.
Note: I tried to implement the __sync_add...() functions which are used in the ...sync.hpp files. For a detailed description of these functions, please refer to http://www.mcs.vuw.ac.nz/cgi-bin/info2www?(gcc)Atomic+Builtins

Best regards,

Rudi Dittrich

> --
> Matthew L. Creech
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: 02-atomic-count-pthreads-on-arm.patch
> Type: application/octet-stream
> Size: 741 bytes
> Desc: not available
> URL:
> <http://lists.boost.org/MailArchives/boost-users/attachments/20080924/f9ad0efd/attachment.obj>
>
> ------------------------------

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net