Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main Repositories
otb
Commits
a048449d
Commit
a048449d
authored
7 years ago
by
Guillaume Pasero
Browse files
Options
Downloads
Patches
Plain Diff
ENH: protect AbortGenerateData with mutex for ImageFileReader
parent
496253f0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Modules/IO/ImageIO/include/otbImageFileWriter.h
+9
-0
9 additions, 0 deletions
Modules/IO/ImageIO/include/otbImageFileWriter.h
Modules/IO/ImageIO/include/otbImageFileWriter.txx
+23
-2
23 additions, 2 deletions
Modules/IO/ImageIO/include/otbImageFileWriter.txx
with
32 additions
and
2 deletions
Modules/IO/ImageIO/include/otbImageFileWriter.h
+
9
−
0
View file @
a048449d
...
...
@@ -25,6 +25,7 @@
#include
"itkProcessObject.h"
#include
"otbStreamingManager.h"
#include
"otbExtendedFilenameToWriterOptions.h"
#include
"itkFastMutexLock.h"
namespace
otb
{
...
...
@@ -199,6 +200,11 @@ public:
itkGetObjectMacro
(
ImageIO
,
otb
::
ImageIOBase
);
itkGetConstObjectMacro
(
ImageIO
,
otb
::
ImageIOBase
);
// the interface of the superclass getter function is not thread safe
bool
GetAbortGenerateDataMutex
()
const
;
void
SetAbortGenerateData
(
bool
val
)
override
;
protected
:
ImageFileWriter
();
~
ImageFileWriter
()
ITK_OVERRIDE
;
...
...
@@ -270,6 +276,9 @@ private:
* This variable can be the number of components in m_ImageIO or the
* number of components in the m_BandList (if used) */
unsigned
int
m_IOComponents
;
/** Lock to ensure thread-safety (added for the AbortGenerateData flag) */
itk
::
SimpleFastMutexLock
m_Lock
;
};
}
// end namespace otb
...
...
This diff is collapsed.
Click to expand it.
Modules/IO/ImageIO/include/otbImageFileWriter.txx
+
23
−
2
View file @
a048449d
...
...
@@ -616,7 +616,7 @@ ImageFileWriter<TInputImage>
}
for (m_CurrentDivision = 0;
m_CurrentDivision < m_NumberOfDivisions && !this->GetAbortGenerateData();
m_CurrentDivision < m_NumberOfDivisions && !this->GetAbortGenerateData
Mutex
();
m_CurrentDivision++, m_DivisionProgress = 0, this->UpdateFilterProgress())
{
streamRegion = m_StreamingManager->GetSplit(m_CurrentDivision);
...
...
@@ -645,7 +645,7 @@ ImageFileWriter<TInputImage>
* If we ended due to aborting, push the progress up to 1.0 (since
* it probably didn't end there)
*/
if (!this->GetAbortGenerateData())
if (!this->GetAbortGenerateData
Mutex
())
{
this->UpdateProgress(1.0);
}
...
...
@@ -843,6 +843,27 @@ ImageFileWriter<TInputImage>
return this->m_FilenameHelper->GetSimpleFileName();
}
template <class TInputImage>
bool
ImageFileWriter<TInputImage>
::GetAbortGenerateDataMutex() const
{
m_Lock.Lock();
bool ret = Superclass::GetAbortGenerateData();
m_Lock.Unlock();
return ret;
}
template <class TInputImage>
void
ImageFileWriter<TInputImage>
::SetAbortGenerateData(bool val)
{
m_Lock.Lock();
Superclass::SetAbortGenerateData(val);
m_Lock.Unlock();
}
} // end namespace otb
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment