LCOV - code coverage report
Current view: top level - framework/source/fwi/helper - shareablemutex.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 21 28 75.0 %
Date: 2012-08-25 Functions: 5 6 83.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 5 14 35.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <helper/shareablemutex.hxx>
      30                 :            : 
      31                 :            : namespace framework
      32                 :            : {
      33                 :            : 
      34                 :        424 : ShareableMutex::ShareableMutex()
      35                 :            : {
      36         [ +  - ]:        424 :     pMutexRef = new MutexRef;
      37                 :        424 :     pMutexRef->acquire();
      38                 :        424 : }
      39                 :            : 
      40                 :       3666 : ShareableMutex::ShareableMutex( const ShareableMutex& rShareableMutex )
      41                 :            : {
      42                 :       3666 :     pMutexRef = rShareableMutex.pMutexRef;
      43         [ +  - ]:       3666 :     if ( pMutexRef )
      44                 :       3666 :         pMutexRef->acquire();
      45                 :       3666 : }
      46                 :            : 
      47                 :          0 : const ShareableMutex& ShareableMutex::operator=( const ShareableMutex& rShareableMutex )
      48                 :            : {
      49         [ #  # ]:          0 :     if ( rShareableMutex.pMutexRef )
      50                 :          0 :         rShareableMutex.pMutexRef->acquire();
      51         [ #  # ]:          0 :     if ( pMutexRef )
      52                 :          0 :         pMutexRef->release();
      53                 :          0 :     pMutexRef = rShareableMutex.pMutexRef;
      54                 :          0 :     return *this;
      55                 :            : }
      56                 :            : 
      57                 :       4090 : ShareableMutex::~ShareableMutex()
      58                 :            : {
      59         [ +  - ]:       4090 :     if ( pMutexRef )
      60                 :       4090 :         pMutexRef->release();
      61                 :       4090 : }
      62                 :            : 
      63                 :     894347 : void ShareableMutex::acquire()
      64                 :            : {
      65         [ +  - ]:     894347 :     if ( pMutexRef )
      66                 :     894347 :         pMutexRef->m_oslMutex.acquire();
      67                 :     894347 : }
      68                 :            : 
      69                 :     894347 : void ShareableMutex::release()
      70                 :            : {
      71         [ +  - ]:     894347 :     if ( pMutexRef )
      72                 :     894347 :         pMutexRef->m_oslMutex.release();
      73                 :     894347 : }
      74                 :            : 
      75                 :            : }
      76                 :            : 
      77                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10