AJA NTV2 SDK
17.1.1.1245
NTV2 SDK 17.1.1.1245
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
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
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
#else
12
// include the system dependent implementation class
13
#if defined(AJA_WINDOWS)
14
#include "
ajabase/system/windows/lockimpl.h
"
15
#elif defined(AJA_LINUX)
16
#include "
ajabase/system/linux/lockimpl.h
"
17
#elif defined(AJA_MAC)
18
#include "
ajabase/system/mac/lockimpl.h
"
19
#elif defined(AJA_BAREMETAL)
20
#include "
ajabase/system/bm/lockimpl.h
"
21
#endif
22
#endif
23
24
25
AJALock::AJALock
(
const
char
* pName)
26
{
27
#if defined(AJA_USE_CPLUSPLUS11) && !defined(AJA_BAREMETAL)
28
mpMutex =
new
recursive_timed_mutex;
29
if
(pName !=
nullptr
)
30
name = pName;
31
#else
32
mpImpl =
NULL
;
33
mpImpl =
new
AJALockImpl
(pName);
34
#endif
35
}
36
37
AJALock::AJALock
(
const
AJALock
& inLock)
38
{
// Copy constructor -- only name is copied...
39
#if defined(AJA_USE_CPLUSPLUS11) && !defined(AJA_BAREMETAL)
40
mpMutex =
new
recursive_timed_mutex;
41
name = inLock.name;
42
#else
43
mpImpl =
NULL
;
44
mpImpl =
new
AJALockImpl
(
NULL
);
// FOR NOW, NAME NOT COPIED -- TBD: inLock.mpImpl->mName);
45
#endif
46
}
47
48
AJALock
&
AJALock::operator =
(
const
AJALock
& inLock)
49
{
// Assignment operator -- no-op
50
(
void
) inLock;
51
return
*
this
;
52
}
53
54
55
AJALock::~AJALock
()
56
{
57
#if defined(AJA_USE_CPLUSPLUS11) && !defined(AJA_BAREMETAL)
58
delete
mpMutex;
59
mpMutex =
nullptr
;
60
#else
61
if
(mpImpl)
62
delete
mpImpl;
63
#endif
64
}
65
66
// interface to the implementation class
67
68
AJAStatus
69
AJALock::Lock
(uint32_t timeout)
70
{
71
#if defined(AJA_USE_CPLUSPLUS11) && !defined(AJA_BAREMETAL)
72
if
(timeout !=
LOCK_TIME_INFINITE
)
73
{
74
bool
success = mpMutex->try_lock_for(std::chrono::milliseconds(timeout));
75
return
success ?
AJA_STATUS_SUCCESS
:
AJA_STATUS_TIMEOUT
;
76
}
77
else
78
{
79
mpMutex->lock();
80
return
AJA_STATUS_SUCCESS
;
81
}
82
#else
83
return
mpImpl->
Lock
(timeout);
84
#endif
85
}
86
87
88
AJAStatus
89
AJALock::Unlock
()
90
{
91
#if defined(AJA_USE_CPLUSPLUS11) && !defined(AJA_BAREMETAL)
92
mpMutex->unlock();
93
return
AJA_STATUS_SUCCESS
;
94
#else
95
return
mpImpl->
Unlock
();
96
#endif
97
}
98
99
100
AJAAutoLock::AJAAutoLock
(
AJALock
* pLock)
101
{
102
mpLock = pLock;
103
if
(mpLock)
104
{
105
mpLock->
Lock
();
106
}
107
}
108
109
110
AJAAutoLock::~AJAAutoLock
()
111
{
112
if
(mpLock)
113
{
114
mpLock->
Unlock
();
115
}
116
}
lockimpl.h
Declares the AJALockImpl class.
LOCK_TIME_INFINITE
#define LOCK_TIME_INFINITE
Definition:
lock.h:20
lockimpl.h
Declares the AJALockImpl class.
NULL
#define NULL
Definition:
ntv2caption608types.h:19
AJA_STATUS_SUCCESS
@ AJA_STATUS_SUCCESS
Definition:
types.h:381
AJALockImpl::Unlock
AJAStatus Unlock()
Definition:
lockimpl.cpp:143
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:110
AJALock::AJALock
AJALock(const char *pName=NULL)
Definition:
lock.cpp:25
AJALock::Lock
virtual AJAStatus Lock(uint32_t timeout=0xffffffff)
Definition:
lock.cpp:69
AJALock
Definition:
lock.h:30
lockimpl.h
Declares the AJALockImpl class.
AJALockImpl::Lock
AJAStatus Lock(uint32_t uTimeout=0xffffffff)
Definition:
lockimpl.cpp:87
AJA_STATUS_TIMEOUT
@ AJA_STATUS_TIMEOUT
Definition:
types.h:384
AJALock::operator=
virtual AJALock & operator=(const AJALock &inLock)
Definition:
lock.cpp:48
AJAAutoLock::AJAAutoLock
AJAAutoLock(AJALock *pLock=NULL)
Definition:
lock.cpp:100
AJALock::Unlock
virtual AJAStatus Unlock()
Definition:
lock.cpp:89
AJALock::~AJALock
virtual ~AJALock()
Definition:
lock.cpp:55
lockimpl.h
libajantv2
ajabase
system
lock.cpp
Generated on Tue Oct 1 2024 16:20:56 for AJA NTV2 SDK by
1.8.17