LCOV - code coverage report
Current view: top level - lunchbox - threadID.cpp (source / functions) Hit Total Coverage
Test: Lunchbox Lines: 13 22 59.1 %
Date: 2015-07-07 14:54:45 Functions: 6 9 66.7 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2010-2013, Stefan Eilemann <eile@eyescale.ch>
       3             :  *
       4             :  * This library is free software; you can redistribute it and/or modify it under
       5             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       6             :  * by the Free Software Foundation.
       7             :  *
       8             :  * This library is distributed in the hope that it will be useful, but WITHOUT
       9             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      10             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      11             :  * details.
      12             :  *
      13             :  * You should have received a copy of the GNU Lesser General Public License
      14             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      15             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      16             :  */
      17             : 
      18             : #include "threadID.h"
      19             : 
      20             : #include "log.h"
      21             : 
      22             : #include <pthread.h>
      23             : #include <cstring>   // for memset
      24             : 
      25             : #include "detail/threadID.h"
      26             : 
      27             : namespace lunchbox
      28             : {
      29     7785468 : ThreadID::ThreadID()
      30     7785468 :         : _impl( new detail::ThreadID )
      31             : {
      32     8060619 :     memset( &_impl->pthread, 0, sizeof( pthread_t ));
      33     8060619 : }
      34             : 
      35           0 : ThreadID::ThreadID( const ThreadID& from )
      36           0 :         : _impl( new detail::ThreadID )
      37             : {
      38           0 :     _impl->pthread = from._impl->pthread;
      39           0 : }
      40             : 
      41     8057950 : ThreadID::~ThreadID()
      42             : {
      43     8057950 :     delete _impl;
      44     8002637 : }
      45             : 
      46     3249071 : ThreadID& ThreadID::operator = ( const ThreadID& from )
      47             : {
      48     3249071 :     _impl->pthread = from._impl->pthread;
      49     3249071 :     return *this;
      50             : }
      51             : 
      52     4764934 : bool ThreadID::operator == ( const ThreadID& rhs ) const
      53             : {
      54     4764934 :     return pthread_equal( _impl->pthread, rhs._impl->pthread );
      55             : }
      56             : 
      57           0 : bool ThreadID::operator != ( const ThreadID& rhs ) const
      58             : {
      59           0 :     return !pthread_equal( _impl->pthread, rhs._impl->pthread );
      60             : }
      61             : 
      62           0 : std::ostream& operator << ( std::ostream& os, const ThreadID& threadID )
      63             : {
      64             : #ifdef PTW32_VERSION
      65             :     os << threadID._impl->pthread.p;
      66             : #else
      67           0 :     os << threadID._impl->pthread;
      68             : #endif
      69           0 :     return os;
      70             : }
      71             : 
      72          81 : }

Generated by: LCOV version 1.11