LCOV - code coverage report
Current view: top level - libreoffice/framework/inc/threadhelp - irwlock.h (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 2 100.0 %
Date: 2012-12-27 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef __FRAMEWORK_THREADHELP_IRWLOCK_H_
      21             : #define __FRAMEWORK_THREADHELP_IRWLOCK_H_
      22             : 
      23             : namespace framework{
      24             : 
      25             : /*-************************************************************************************************************//**
      26             :     @descr          A guard (specialy a write guard) support different internal working states.
      27             :                     His lock can set for reading or writing/reading! Or he was unlocked by user ...
      28             : *//*-*************************************************************************************************************/
      29             : enum ELockMode
      30             : {
      31             :     E_NOLOCK    ,
      32             :     E_READLOCK  ,
      33             :     E_WRITELOCK
      34             : };
      35             : 
      36             : /*-************************************************************************************************************//**
      37             :     @descr          We implement two guards for using an rw-lock. But if you wish to implement
      38             :                     different rw-locks to you will have problems by using with same guard implementation!
      39             :                     Thats why we define this "pure virtual base class" ...
      40             :                     All rw-locks must support this base interface for working and all guard must use this one too!
      41             : *//*-*************************************************************************************************************/
      42       36282 : class IRWLock
      43             : {
      44             :     //-------------------------------------------------------------------------------------------------------------
      45             :     //  public methods
      46             :     //-------------------------------------------------------------------------------------------------------------
      47             :     public:
      48             : 
      49             :         /*-****************************************************************************************************//**
      50             :             @descr      These functions must be supported by a derived class!
      51             :                             acquireReadAccess()     -try to register thread as reader
      52             :                             releaseReadAccess()     -unregister thread as reader
      53             :                             acquireWriteAccess()    -try to register thread as writer
      54             :                             releaseWriteAccess()    -unregister thread as writer
      55             :                             downgradeWriteAccess()  -make writer to reader
      56             :         *//*-*****************************************************************************************************/
      57             :         virtual void acquireReadAccess    () =0;
      58             :         virtual void releaseReadAccess    () =0;
      59             :         virtual void acquireWriteAccess   () =0;
      60             :         virtual void releaseWriteAccess   () =0;
      61             :         virtual void downgradeWriteAccess () =0;
      62             : 
      63             :     protected:
      64       30441 :         ~IRWLock() {}
      65             : };      //  class IRWLock
      66             : 
      67             : }       //  namespace framework
      68             : 
      69             : #endif  //  #ifndef __FRAMEWORK_THREADHELP_IRWLOCK_H_
      70             : 
      71             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10