LCOV - code coverage report
Current view: directory - src/shared/platform - nacl_sync_raii.h (source / functions) Found Hit Coverage
Test: coverage.lcov Lines: 9 0 0.0 %
Date: 2012-02-16 Functions: 0 0 -

       1                 : /*
       2                 :  * Copyright (c) 2011 The Native Client Authors. All rights reserved.
       3                 :  * Use of this source code is governed by a BSD-style license that can be
       4                 :  * found in the LICENSE file.
       5                 :  */
       6                 : 
       7                 : /*
       8                 :  * RAII wrappers for nacl_sync objects.  C++ only header file
       9                 :  */
      10                 : 
      11                 : #ifndef NATIVE_CLIENT_SRC_SHARED_PLATFORM_NACL_SYNC_RAII_H_
      12                 : #define NATIVE_CLIENT_SRC_SHARED_PLATFORM_NACL_SYNC_RAII_H_
      13                 : 
      14                 : #include "native_client/src/include/portability.h"  // NACL_PRIxPTR etc
      15                 : #include "native_client/src/shared/platform/nacl_sync_checked.h"
      16                 : #include "native_client/src/shared/platform/nacl_log.h"
      17                 : 
      18                 : namespace nacl {
      19                 : 
      20                 : static char const* const kMutexLockerModuleName = "nacl_sync_raii";
      21                 : 
      22                 : class MutexLocker {
      23                 :  public:
      24               0 :   explicit MutexLocker(NaClMutex* mu)
      25               0 :       : mu_(mu) {
      26                 :     NaClLog2(kMutexLockerModuleName, 3,
      27                 :              "MutexLocker: taking lock %"NACL_PRIxPTR"\n",
      28               0 :              (uintptr_t) mu_);
      29               0 :     NaClXMutexLock(mu_);
      30               0 :   }
      31               0 :   ~MutexLocker() {
      32                 :     NaClLog2(kMutexLockerModuleName, 3,
      33                 :              "MutexLocker: dropping lock %"NACL_PRIxPTR"\n",
      34               0 :              (uintptr_t) mu_);
      35               0 :     NaClXMutexUnlock(mu_);
      36               0 :   }
      37                 :  private:
      38                 :   NaClMutex* mu_;
      39                 : };
      40                 : 
      41                 : }  // namespace nacl
      42                 : 
      43                 : #endif  // NATIVE_CLIENT_SRC_SHARED_PLATFORM_NACL_SYNC_RAII_H_

Generated by: LCOV version 1.7