rooneypark / naclports

Automatically exported from code.google.com/p/naclports
0 stars 0 forks source link

Boost don't use atomic operation in shared_ptr when compile with NaCl toolchain #124

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

I'm try to build some aplication which use boost and use threads with pepper_31 
and boost 1.55 from nacl ports.
I'm using a shared_ptr from boost which according to used toolchain compile 
with different implementation of counted_base.
When I use PNaCl toolchain, counter_base with atomic operation is compiled 
(sp_counter_base_sync.hpp).
But when I use NaCl toolchan compiler use counter_base which use only increment 
and decrement operation to change shared_ptr refence 
number(sp_counter_base_nt.hpp).

I find out that in libstdcpp3.hpp macro BOOST_DISABLE_THREADS is set (for NaCl 
toolchain) and that why wrong version of counter_base is inlcuded in 
sp_counted_base.hpp.
In my project I change nacl.patch for boost (form NaCl ports), adding two lines:
    #undef BOOST_DISABLE_THREADS
    #define BOOST_HAS_THREADS
This make that when use NaCl toolchain shred_ptr from boost always use 
counted_base with atomic operation.

It's this behavior is for some reasons? Or this is a bug in boost when use NaCl 
toolchain?

Original issue reported on code.google.com by marcin.s...@gmail.com on 16 Jun 2014 at 9:46

Attachments: