LCOV - code coverage report
Current view: directory - src/trusted/debug_stub - mutex.h (source / functions) Found Hit Coverage
Test: coverage.lcov Lines: 6 6 100.0 %
Date: 2014-06-18 Functions: 0 0 -

       1                 : /*
       2                 :  * Copyright 2010 The Native Client Authors. All rights reserved.
       3                 :  * Use of this source code is governed by a BSD-style license that can
       4                 :  * be found in the LICENSE file.
       5                 :  */
       6                 : 
       7                 : #ifndef NATIVE_CLIENT_PORT_MUTEX_H_
       8                 : #define NATIVE_CLIENT_PORT_MUTEX_H_ 1
       9                 : 
      10                 : #include <assert.h>
      11                 : #include <stddef.h>
      12                 : 
      13                 : #include "native_client/src/shared/platform/nacl_sync_checked.h"
      14                 : 
      15                 : namespace port {
      16                 : 
      17                 : 
      18                 : // MutexLock
      19                 : //   A MutexLock object will lock on construction and automatically
      20                 : // unlock on destruction of the object as the object goes out of scope.
      21                 : class MutexLock {
      22                 :  public:
      23             370 :   explicit MutexLock(struct NaClMutex *mutex) : mutex_(mutex) {
      24             185 :     NaClXMutexLock(mutex_);
      25             370 :   }
      26             170 :   ~MutexLock() {
      27             170 :     NaClXMutexUnlock(mutex_);
      28             340 :   }
      29                 : 
      30                 :  private:
      31                 :   struct NaClMutex *mutex_;
      32                 :   MutexLock(const MutexLock&);
      33                 :   MutexLock &operator=(const MutexLock&);
      34                 : };
      35                 : 
      36                 : 
      37                 : }  // namespace port
      38                 : 
      39                 : #endif  // NATIVE_CLIENT_PORT_MUTEX_H_
      40                 : 

Generated by: LCOV version 1.7