LCOV - code coverage report
Current view: top level - lunchbox - threadID.cpp (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 15 22 68.2 %
Date: 2014-10-01 Functions: 7 9 77.8 %

          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     6963955 : ThreadID::ThreadID()
      30     6963955 :         : _impl( new detail::ThreadID )
      31             : {
      32     7029735 :     memset( &_impl->pthread, 0, sizeof( pthread_t ));
      33     7029735 : }
      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     6840015 : ThreadID::~ThreadID()
      42             : {
      43     6840015 :     delete _impl;
      44     6964655 : }
      45             : 
      46     2865658 : ThreadID& ThreadID::operator = ( const ThreadID& from )
      47             : {
      48     2865658 :     _impl->pthread = from._impl->pthread;
      49     2865658 :     return *this;
      50             : }
      51             : 
      52     4288965 : bool ThreadID::operator == ( const ThreadID& rhs ) const
      53             : {
      54     4288965 :     return pthread_equal( _impl->pthread, rhs._impl->pthread );
      55             : }
      56             : 
      57         306 : bool ThreadID::operator != ( const ThreadID& rhs ) const
      58             : {
      59         306 :     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          90 : }

Generated by: LCOV version 1.10