Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Main Repositories
otb
Commits
b3b9f74b
Commit
b3b9f74b
authored
Jan 29, 2021
by
Julien Osman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIX: Add locks to otbGDALRPCTransformer to prevent multi-thread concurrency
parent
a2b344e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
Modules/IO/IOGDAL/src/otbGDALRPCTransformer.cxx
Modules/IO/IOGDAL/src/otbGDALRPCTransformer.cxx
+4
-0
No files found.
Modules/IO/IOGDAL/src/otbGDALRPCTransformer.cxx
View file @
b3b9f74b
...
...
@@ -133,6 +133,7 @@ bool GDALRPCTransformer::ForwardTransform(double* x, double* y, double* z, int n
if
(
this
->
m_Modified
)
this
->
Update
();
std
::
vector
<
int
>
success
(
nPointCount
);
const
std
::
lock_guard
<
std
::
mutex
>
lock
(
m_Mutex
);
GDALRPCTransform
(
this
->
m_TransformArg
,
false
,
nPointCount
,
x
,
y
,
z
,
success
.
data
());
bool
finalSuccess
=
std
::
all_of
(
success
.
begin
(),
success
.
end
(),
[](
int
i
){
return
i
;});
return
finalSuccess
;
...
...
@@ -143,6 +144,7 @@ GDALRPCTransformer::PointType GDALRPCTransformer::ForwardTransform(GDALRPCTransf
if
(
m_Modified
)
this
->
Update
();
int
success
;
const
std
::
lock_guard
<
std
::
mutex
>
lock
(
m_Mutex
);
GDALRPCTransform
(
this
->
m_TransformArg
,
false
,
1
,
&
p
[
0
],
&
p
[
1
],
&
p
[
2
],
&
success
);
if
(
!
success
)
throw
std
::
runtime_error
(
"GDALRPCTransform was not able to process the ForwardTransform."
);
...
...
@@ -158,6 +160,7 @@ bool GDALRPCTransformer::InverseTransform(double* x, double* y, double* z, int n
if
(
this
->
m_Modified
)
this
->
Update
();
std
::
vector
<
int
>
success
(
nPointCount
);
const
std
::
lock_guard
<
std
::
mutex
>
lock
(
m_Mutex
);
GDALRPCTransform
(
this
->
m_TransformArg
,
true
,
nPointCount
,
x
,
y
,
z
,
success
.
data
());
bool
finalSuccess
=
std
::
all_of
(
success
.
begin
(),
success
.
end
(),
[](
int
i
){
return
i
;});
return
finalSuccess
;
...
...
@@ -168,6 +171,7 @@ GDALRPCTransformer::PointType GDALRPCTransformer::InverseTransform(GDALRPCTransf
if
(
m_Modified
)
this
->
Update
();
int
success
;
const
std
::
lock_guard
<
std
::
mutex
>
lock
(
m_Mutex
);
GDALRPCTransform
(
this
->
m_TransformArg
,
true
,
1
,
&
p
[
0
],
&
p
[
1
],
&
p
[
2
],
&
success
);
if
(
!
success
)
throw
std
::
runtime_error
(
"GDALRPCTransform was not able to process the InverseTransform."
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment