Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LimaGroup
Lima-camera-slsdetector
Commits
8a15207f
Commit
8a15207f
authored
Apr 10, 2020
by
Alejandro Homs Puron
Committed by
operator for beamline
Apr 27, 2020
Browse files
Improve Eiger::Thread state machine, add Stopping state
parent
908a668d
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/SlsDetectorEiger.h
View file @
8a15207f
...
...
@@ -323,7 +323,7 @@ class Eiger : public Model
DEB_CLASS_NAMESPC
(
DebModCamera
,
"Eiger::Thread"
,
"SlsDetector"
);
public:
enum
State
{
Init
,
Ready
,
Running
,
Stop
,
End
,
Init
,
Ready
,
Running
,
Stop
ping
,
Quitting
,
End
,
};
Thread
(
Eiger
*
eiger
,
int
idx
);
...
...
@@ -336,7 +336,12 @@ class Eiger : public Model
void
startAcq
()
{
setState
(
Running
);
}
void
stopAcq
()
{
setState
(
Ready
);
}
{
setState
(
Stopping
);
AutoMutex
l
=
lock
();
while
(
m_state
!=
Ready
)
wait
();
}
protected:
virtual
void
threadFunction
();
...
...
@@ -549,20 +554,12 @@ class Eiger : public Model
bool
allFramesAcquired
()
{
return
m_next_frame
==
m_nb_frames
;
}
bool
checkForRecvState
(
Thread
&
t
)
{
while
((
t
.
m_state
==
Thread
::
Ready
)
||
((
t
.
m_state
==
Thread
::
Running
)
&&
allFramesAcquired
()))
wait
();
return
(
t
.
m_state
==
Thread
::
Running
);
}
int
getNbRecvs
();
int
getNbProcessingThreads
();
void
setNbProcessingThreads
(
int
nb_proc_threads
);
void
processOneFrame
(
Thread
&
t
,
AutoMutex
&
l
);
void
processOneFrame
(
AutoMutex
&
l
);
CorrBase
*
createBadRecvFrameCorr
();
CorrBase
*
createChipBorderCorr
(
ImageType
image_type
);
...
...
src/SlsDetectorEiger.cpp
View file @
8a15207f
...
...
@@ -664,7 +664,7 @@ Eiger::Thread::~Thread()
DEB_DESTRUCTOR
();
AutoMutex
l
=
lock
();
m_state
=
Stop
;
m_state
=
Quitting
;
broadcast
();
while
(
m_state
!=
End
)
wait
();
...
...
@@ -674,14 +674,26 @@ void Eiger::Thread::threadFunction()
{
DEB_MEMBER_FUNCT
();
State
&
s
=
m_state
;
AutoMutex
l
=
lock
();
m_state
=
Ready
;
s
=
Ready
;
broadcast
();
while
(
m_state
!=
Stop
)
m_eiger
->
processOneFrame
(
*
this
,
l
);
while
(
s
!=
Quitting
)
{
while
((
s
==
Ready
)
||
(
s
==
Stopping
)
||
((
s
==
Running
)
&&
m_eiger
->
allFramesAcquired
()))
{
if
(
s
==
Stopping
)
{
s
=
Ready
;
broadcast
();
}
wait
();
}
if
(
s
==
Running
)
m_eiger
->
processOneFrame
(
l
);
}
m_state
=
End
;
s
=
End
;
broadcast
();
}
...
...
@@ -1299,19 +1311,12 @@ void Eiger::stopAcq()
ThreadList
::
iterator
it
,
end
=
m_thread_list
.
end
();
for
(
it
=
m_thread_list
.
begin
();
it
!=
end
;
++
it
)
(
*
it
)
->
stopAcq
();
AutoMutex
l
=
lock
();
while
(
!
m_in_process
.
empty
())
wait
();
}
void
Eiger
::
processOneFrame
(
Thread
&
t
,
AutoMutex
&
l
)
void
Eiger
::
processOneFrame
(
AutoMutex
&
l
)
{
DEB_MEMBER_FUNCT
();
if
(
!
checkForRecvState
(
t
))
return
;
FrameType
frame
=
m_next_frame
++
;
class
Sync
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment