You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Ben Craig (JIRA)" <ji...@apache.org> on 2013/03/06 16:58:13 UTC

[jira] [Commented] (THRIFT-1875) BoostThreadFactory not compiling

    [ https://issues.apache.org/jira/browse/THRIFT-1875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13594805#comment-13594805 ] 

Ben Craig commented on THRIFT-1875:
-----------------------------------

My suspicion is that this is the wrong fix for the problem.  Thread.h has the following code:

#ifdef USE_BOOST_THREAD
  typedef boost::thread::id id_t;

  static inline bool is_current(id_t t) { return t == boost::this_thread::get_id(); }
  static inline id_t get_current() { return boost::this_thread::get_id(); }
#else
  typedef pthread_t id_t;
  static inline bool is_current(id_t t) { return pthread_equal(pthread_self(), t); }
  static inline id_t get_current() { return pthread_self(); }
#endif

If USE_BOOST_THREAD isn't defined, then you will try to convert a BoostThread::getId() will try to convert a boost::thread::id to a pthread_t.

Basically, you should try to fix the typedef, and not the getId() call.
                
> BoostThreadFactory not compiling
> --------------------------------
>
>                 Key: THRIFT-1875
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1875
>             Project: Thrift
>          Issue Type: Bug
>          Components: Build Process, C++ - Library
>    Affects Versions: 0.9
>         Environment: boost 1.44
> gcc 4.7.2
>            Reporter: Konrad Grochowski
>         Attachments: THRIFT-1875-lexical_cast_fix.patch
>
>
> lib/cpp/src/thrift/concurrency/BoostThreadFactory.cpp:102:66: error: cannot convert ‘boost::thread::id’ to ‘apache::thrift::concurrency::Thread::id_t {aka long unsigned int}’ in return
> boost::thread::id is a class, cannot be cast to thrift::...::Thread::id_t (long)
> seems I'm not the only one with that problem:
> http://mail-archives.apache.org/mod_mbox/thrift-user/201209.mbox/%3C993D39BB-2292-4641-9403-E76C29BECF22@manbert.com%3E

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira