Hugin trunk
0.1
Loading...
Searching...
No Matches
hugin_base
hugin_utils
openmp_lock.h
Go to the documentation of this file.
1
// -*- c-basic-offset: 4 -*-
2
8
/* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public
10
* License as published by the Free Software Foundation; either
11
* version 2 of the License, or (at your option) any later version.
12
*
13
* This software is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public
19
* License along with this software. If not, see
20
* <http://www.gnu.org/licenses/>.
21
*
22
*/
23
24
#ifndef OPENMP_LOCK_H
25
#define OPENMP_LOCK_H
26
27
#include <hugin_config.h>
28
29
namespace
hugin_omp
30
{
31
32
#ifdef HAVE_OPENMP
33
#include <omp.h>
34
36
class
Lock
37
{
38
public
:
39
Lock
() {
omp_init_lock
(&m_lock);}
40
~Lock
() {
omp_destroy_lock
(&m_lock);}
41
42
void
Set
() {
omp_set_lock
(&m_lock);}
43
void
Unset
() {
omp_unset_lock
(&m_lock);}
44
bool
Test
() {
return
(
omp_test_lock
(&m_lock) != 0);}
45
private
:
46
Lock
(
const
Lock
&);
47
Lock
& operator=(
const
Lock
&);
48
omp_lock_t
m_lock;
49
};
50
#else
51
/* A dummy mutex that doesn't actually exclude anything,
52
* but as there is no parallelism either, no worries. */
53
class
Lock
54
{
55
public
:
56
void
Set
() {}
57
void
Unset
() {}
58
bool
Test
() {
return
false
; }
59
};
60
#endif
61
62
/* An exception-safe scoped lock-keeper. */
63
class
ScopedLock
64
{
65
public
:
66
ScopedLock
(
Lock
&
lock
):
m_lock
(
lock
) {
m_lock
.
Set
();}
67
~ScopedLock
() {
m_lock
.
Unset
();}
68
private
:
69
ScopedLock
(
const
ScopedLock
&);
70
ScopedLock
&
operator=
(
const
ScopedLock
&);
71
Lock
&
m_lock
;
72
};
73
74
};
// namespace omp
75
#endif
lock
static hugin_omp::Lock lock
Definition
align_image_stack.cpp:118
hugin_omp::Lock
Definition
openmp_lock.h:54
hugin_omp::Lock::Set
void Set()
Definition
openmp_lock.h:56
hugin_omp::Lock::Test
bool Test()
Definition
openmp_lock.h:58
hugin_omp::Lock::Unset
void Unset()
Definition
openmp_lock.h:57
hugin_omp::ScopedLock
Definition
openmp_lock.h:64
hugin_omp::ScopedLock::operator=
ScopedLock & operator=(const ScopedLock &)
hugin_omp::ScopedLock::m_lock
Lock & m_lock
Definition
openmp_lock.h:71
hugin_omp::ScopedLock::ScopedLock
ScopedLock(Lock &lock)
Definition
openmp_lock.h:66
hugin_omp::ScopedLock::~ScopedLock
~ScopedLock()
Definition
openmp_lock.h:67
hugin_omp::ScopedLock::ScopedLock
ScopedLock(const ScopedLock &)
hugin_omp
Definition
openmp_lock.h:30
threshold
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition
threshold.h:41
Generated on Sun Sep 13 2026 02:49:55 for Hugin trunk by
1.9.8