/usr/include/libGenome-1.3/libGenome/OmpGuard.h is in libgenome-1.3-dev 1.3.1-9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | /*******************************************************************************
* $Id: OmpGuard.h,v 1.6 2004/02/27 23:08:55 darling Exp $
* This file is copyright 2002-2007 Aaron Darling and authors listed in the AUTHORS file.
* This file is licensed under the GPL.
* Please see the file called COPYING for licensing details.
* **************
******************************************************************************/
#ifndef _OmpGuard_h_
#define _OmpGuard_h_
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef _OPENMP
#include <omp.h>
#endif
namespace genome {
#ifdef _OPENMP
/** This is a class for guard objects using OpenMP
* It is adapted from the book
* "Pattern-Oriented Software Architecture". */
class omp_guard {
public:
/** Acquire the lock and store a pointer to it */
omp_guard (omp_lock_t &lock){
lock_ = &lock;
acquire ();
}
/** Set the lock explicitly */
void acquire (){
omp_set_lock (lock_);
owner_ = true;
}
/** Release the lock explicitly (owner thread only!) */
void release (){
if (owner_) {
owner_ = false;
omp_unset_lock (lock_);
};
}
/** Destruct guard object */
~omp_guard (){ release (); }
private:
omp_lock_t *lock_; // pointer to our lock
bool owner_; // is this object the owner of the lock?
// Disallow copies or assignment
omp_guard (const omp_guard &);
void operator= (const omp_guard &);
};
#else
// provide non-openmp stubs
typedef int omp_lock_t;
class omp_guard {
public:
omp_guard (omp_lock_t &lock){}
void acquire (){}
void release (){}
private:
// Disallow copies or assignment
omp_guard (const omp_guard &);
void operator= (const omp_guard &);
};
inline void omp_init_lock( omp_lock_t* dummy_lock ){}
inline void omp_destroy_lock( omp_lock_t* dummy_lock ){}
#endif // ifdef _OPENMP
} // namespace genome
#endif // _OmpGuard_h_
|