LCOV - code coverage report
Current view: top level - eq/fabric - init.cpp (source / functions) Hit Total Coverage
Test: Equalizer Lines: 11 13 84.6 %
Date: 2017-12-16 05:07:20 Functions: 4 4 100.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2010-2012, Stefan Eilemann <eile@equalizergraphics.com>
       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 "init.h"
      19             : 
      20             : #include <co/init.h>
      21             : #include <lunchbox/atomic.h>
      22             : 
      23             : namespace eq
      24             : {
      25             : namespace fabric
      26             : {
      27             : namespace
      28             : {
      29          20 : static lunchbox::a_int32_t _initialized;
      30             : }
      31             : extern void _initErrors();
      32             : extern void _exitErrors();
      33             : 
      34           8 : bool init(const int argc, char** argv)
      35             : {
      36           8 :     if (++_initialized > 1) // not first
      37           0 :         return true;
      38             : 
      39           8 :     _initErrors();
      40           8 :     return co::init(argc, argv);
      41             : }
      42             : 
      43           8 : bool exit()
      44             : {
      45           8 :     if (--_initialized > 0) // not last
      46           0 :         return true;
      47             : 
      48           8 :     const bool ret = co::exit();
      49             : 
      50           8 :     _exitErrors();
      51           8 :     return ret;
      52             : }
      53             : }
      54          60 : }

Generated by: LCOV version 1.11