visibility and movable_exception

visibility and movable_exception

Imagen de dmarkman@mathworks.com

on Mac OS X with open source TBB 4.1 consider

class A { //copyable class, good for tbb::movable_exception
public:
   A(size_t n) : m_n(n) {}
   size_t getN() const {return m_n;}
private:
   size_t m_n;
};

class TBBTry {
public:
    void operator() ( const tbb::blocked_range<size_t>& r ) const {
        for ( size_t i = r.begin(); i != r.end(); ++i ) {
             if (((i+1) % 4) == 0) {
                size_t n = i + 100;
               throw tbb::movable_exception<A>(A(n));
            }
       } 
   }
   TBBTry() { }
};

int main() {
    try {
        tbb::parallel_for(tbb::blocked_range<size_t>(0, 5 ), TBBTry() );
    } catch ( tbb::movable_exception<A> &ex) {
        std::cout << "tbb::movable_exception n = " << ex.data().getN() << std::endl;
    } catch ( tbb::captured_exception &ex ) {
        std::cout << "tbb::captured_exception name = " << ex.name() << "; " << ex.what() << std::endl;
    } catch ( ... ) {
        std::cout << "unknown_exception" << std::endl;
   }
    return 0;
}

I expect to see
tbb::movable_exception n = 103

However I see the following output:
tbb::captured_exception name = N3tbb17movable_exceptionI1AEE; tbb::movable_exception

I debugged that issue and found out that we have problem with visibility template exception thrown from separate dll.

Problem is fixed if I do the following changes in the file
tbb_exception.h:

#ifndef __TBB_exception_H
#define __TBB_exception_H

# pragma GCC visibility push (default) //xxx(dmarkman)

...........

# pragma GCC visibility pop //xxx(dmarkman)

#endif /* __TBB_exception_H */

I sbmitted bug report but didn't get back any bugid and when I search bug db I'm getting no records

publicaciones de 2 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.
Imagen de Vladimir Polin (Intel)

Hello,

Thanks for the solution. could you submit a patch via contribution page http://threadingbuildingblocks.org/contribution_first.php?

Bugzilla on our site is not very user-friendly now:) as far as I understand you have submitted 3 bugs: 197, 198, 199.

thank you,
--Vladimir

Inicie sesión para dejar un comentario.