AJA NTV2 SDK
17.5.0.1658
NTV2 SDK 17.5.0.1658
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Functions
a
b
c
e
f
g
h
i
j
k
l
m
o
p
r
s
t
u
v
w
Variables
Typedefs
a
b
c
d
e
f
g
h
i
j
k
m
n
o
p
r
s
t
u
v
Enumerations
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Typedefs
_
a
b
c
d
e
f
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Enumerations
Enumerator
b
c
e
g
k
n
r
v
Related Functions
:
a
b
c
d
j
o
s
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
y
Variables
_
a
b
c
e
f
g
h
i
k
l
m
n
p
r
s
t
u
v
w
Typedefs
_
a
b
c
d
f
h
i
j
l
m
n
o
p
q
r
s
t
u
w
Enumerations
_
a
b
c
d
e
f
h
i
j
k
m
n
p
q
r
s
t
u
v
x
Enumerator
a
b
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
lock.cpp
Go to the documentation of this file.
1
/* SPDX-License-Identifier: MIT */
8
#include "
ajabase/system/lock.h
"
9
#if defined(AJA_USE_CPLUSPLUS11) && !defined(AJA_BAREMETAL)
10
#include <chrono>
11
using namespace
std
;
12
#else
13
// include the system dependent implementation class
14
#if defined(AJA_WINDOWS)
15
#include "
ajabase/system/windows/lockimpl.h
"
16
#elif defined(AJA_LINUX)
17
#include "
ajabase/system/linux/lockimpl.h
"
18
#elif defined(AJA_MAC)
19
#include "
ajabase/system/mac/lockimpl.h
"
20
#elif defined(AJA_BAREMETAL)
21
#include "
ajabase/system/bm/lockimpl.h
"
22
#endif
23
#endif
24
25
26
AJALock::AJALock
(
const
char
* pName)
27
{
28
#if defined(AJA_USE_CPLUSPLUS11) && !defined(AJA_BAREMETAL)
29
mpMutex =
new
recursive_timed_mutex;
30
if
(pName !=
nullptr
)
31
mName = pName;
32
#else
33
mpImpl =
NULL
;
34
mpImpl =
new
AJALockImpl
(pName);
35
#endif
36
}
37
38
AJALock::AJALock
(
const
AJALock
& inLock)
39
{
// Copy constructor -- only name is copied...
40
#if defined(AJA_USE_CPLUSPLUS11) && !defined(AJA_BAREMETAL)
41
mpMutex =
new
recursive_timed_mutex;
42
mName = inLock.mName;
43
#else
44
mpImpl =
NULL
;
45
mpImpl =
new
AJALockImpl
(
NULL
);
// FOR NOW, NAME NOT COPIED -- TBD: inLock.mpImpl->mName);
46
#endif
47
}
48
49
AJALock
&
AJALock::operator =
(
const
AJALock
& inLock)
50
{
// Assignment operator -- no-op
51
(
void
) inLock;
52
return
*
this
;
53
}
54
55
56
AJALock::~AJALock
()
57
{
58
#if defined(AJA_USE_CPLUSPLUS11) && !defined(AJA_BAREMETAL)
59
delete
mpMutex;
60
mpMutex =
nullptr
;
61
#else
62
if
(mpImpl)
63
delete
mpImpl;
64
#endif
65
}
66
67
// interface to the implementation class
68
69
AJAStatus
70
AJALock::Lock
(uint32_t timeout)
71
{
72
#if defined(AJA_USE_CPLUSPLUS11) && !defined(AJA_BAREMETAL)
73
if
(timeout !=
LOCK_TIME_INFINITE
)
74
{
75
bool
success = mpMutex->try_lock_for(std::chrono::milliseconds(timeout));
76
return
success ?
AJA_STATUS_SUCCESS
:
AJA_STATUS_TIMEOUT
;
77
}
78
else
79
{
80
mpMutex->lock();
81
return
AJA_STATUS_SUCCESS
;
82
}
83
#else
84
return
mpImpl->Lock(timeout);
85
#endif
86
}
87
88
89
AJAStatus
90
AJALock::Unlock
()
91
{
92
#if defined(AJA_USE_CPLUSPLUS11) && !defined(AJA_BAREMETAL)
93
mpMutex->unlock();
94
return
AJA_STATUS_SUCCESS
;
95
#else
96
return
mpImpl->Unlock();
97
#endif
98
}
99
100
101
AJAAutoLock::AJAAutoLock
(
AJALock
* pLock)
102
{
103
mpLock = pLock;
104
if
(mpLock)
105
{
106
mpLock->
Lock
();
107
}
108
}
109
110
111
AJAAutoLock::~AJAAutoLock
()
112
{
113
if
(mpLock)
114
{
115
mpLock->Unlock();
116
}
117
}
lockimpl.h
Declares the AJALockImpl class.
LOCK_TIME_INFINITE
#define LOCK_TIME_INFINITE
Definition:
lock.h:18
lockimpl.h
Declares the AJALockImpl class.
NULL
#define NULL
Definition:
ntv2caption608types.h:19
AJA_STATUS_SUCCESS
@ AJA_STATUS_SUCCESS
Definition:
types.h:381
AJALockImpl
Definition:
lockimpl.h:18
nlohmann::json_abiNLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON_v3_11_NLOHMANN_JSON_VERSION_PATCH::detail::void
j template void())
Definition:
json.hpp:4893
AJAStatus
AJAStatus
Definition:
types.h:378
lock.h
Declares the AJALock class.
AJAAutoLock::~AJAAutoLock
virtual ~AJAAutoLock()
Definition:
lock.cpp:111
AJALock::AJALock
AJALock(const char *pName=NULL)
Definition:
lock.cpp:26
AJALock::Lock
virtual AJAStatus Lock(uint32_t timeout=0xffffffff)
Definition:
lock.cpp:70
AJALock
Definition:
lock.h:28
lockimpl.h
Declares the AJALockImpl class.
AJA_STATUS_TIMEOUT
@ AJA_STATUS_TIMEOUT
Definition:
types.h:384
std
Definition:
json.hpp:5362
AJALock::operator=
virtual AJALock & operator=(const AJALock &inLock)
Definition:
lock.cpp:49
AJAAutoLock::AJAAutoLock
AJAAutoLock(AJALock *pLock=NULL)
Definition:
lock.cpp:101
AJALock::Unlock
virtual AJAStatus Unlock()
Definition:
lock.cpp:90
AJALock::~AJALock
virtual ~AJALock()
Definition:
lock.cpp:56
lockimpl.h
libajantv2
ajabase
system
lock.cpp
Generated on Tue Feb 25 2025 18:41:14 for AJA NTV2 SDK by
1.8.17