Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
ITASimulationScheduler
Commits
b9952db3
Commit
b9952db3
authored
Jul 20, 2020
by
Pascal Palenda
Browse files
Add shutdown message
parent
5736d157
Changes
6
Hide whitespace changes
Inline
Side-by-side
include/ITA/simulation_scheduler/room_acoustics/raven/worker_thread.h
View file @
b9952db3
...
@@ -81,6 +81,11 @@ namespace ITA
...
@@ -81,6 +81,11 @@ namespace ITA
///
///
void
reset
(
)
override
;
void
reset
(
)
override
;
///
/// \copydoc IWorkerInterface::shutdown
///
void
shutdown
()
override
;
///
///
/// \brief Factory function for CWorkerThread.
/// \brief Factory function for CWorkerThread.
/// \param pConfig the WorkerConfig used to configure the CWorkerThread.
/// \param pConfig the WorkerConfig used to configure the CWorkerThread.
...
...
include/ITA/simulation_scheduler/scheduler.h
View file @
b9952db3
...
@@ -172,6 +172,11 @@ namespace ITA
...
@@ -172,6 +172,11 @@ namespace ITA
///
///
audibility_filter
::
CFilterNetwork
*
getFilterNetwork
(
)
const
;
audibility_filter
::
CFilterNetwork
*
getFilterNetwork
(
)
const
;
///
/// \brief Shutdown the scheduler safely.
///
void
shutdown
(
);
private:
private:
///
///
/// \brief Process a CUpdateScene.
/// \brief Process a CUpdateScene.
...
...
include/ITA/simulation_scheduler/update_config.h
View file @
b9952db3
...
@@ -26,6 +26,7 @@ namespace ITA
...
@@ -26,6 +26,7 @@ namespace ITA
enum
class
ConfigChangeType
enum
class
ConfigChangeType
{
{
resetAll
,
///< Reset all simulations.
resetAll
,
///< Reset all simulations.
shutdown
,
///< Shutdown the system.
changeHRTF
,
///< Signal a change in receiver HRTF.
changeHRTF
,
///< Signal a change in receiver HRTF.
changeDirectivity
///< Signal a change in source directivity.
changeDirectivity
///< Signal a change in source directivity.
};
};
...
...
include/ITA/simulation_scheduler/worker_interface.h
View file @
b9952db3
...
@@ -93,6 +93,11 @@ namespace ITA
...
@@ -93,6 +93,11 @@ namespace ITA
///
///
virtual
void
reset
(
)
=
0
;
virtual
void
reset
(
)
=
0
;
///
/// \brief Shutdown the worker safely.
///
virtual
void
shutdown
(
)
=
0
;
protected:
protected:
///
///
...
...
src/ITA/simulation_scheduler/room_acoustics/raven/worker_thread.cpp
View file @
b9952db3
...
@@ -119,6 +119,17 @@ namespace ITA
...
@@ -119,6 +119,17 @@ namespace ITA
m_bResetIndicated
=
false
;
m_bResetIndicated
=
false
;
}
}
void
CWorkerThread
::
shutdown
()
{
m_bStopIndicated
=
true
;
m_evTriggerLoop
.
SignalEvent
(
);
// Wait for the end of the simulation
while
(
isBusy
(
)
)
VistaTimeUtils
::
Sleep
(
100
);
StopGently
(
true
);
}
std
::
unique_ptr
<
IWorkerInterface
>
CWorkerThread
::
createWorker
(
std
::
unique_ptr
<
IWorkerInterface
>
CWorkerThread
::
createWorker
(
const
std
::
shared_ptr
<
IWorkerInterface
::
WorkerConfig
>&
pConfig
,
ISchedulerInterface
*
pParent
)
const
std
::
shared_ptr
<
IWorkerInterface
::
WorkerConfig
>&
pConfig
,
ISchedulerInterface
*
pParent
)
{
{
...
...
src/ITA/simulation_scheduler/scheduler.cpp
View file @
b9952db3
...
@@ -184,6 +184,9 @@ namespace ITA
...
@@ -184,6 +184,9 @@ namespace ITA
case
CUpdateConfig
::
ConfigChangeType
::
resetAll
:
case
CUpdateConfig
::
ConfigChangeType
::
resetAll
:
reset
(
);
reset
(
);
break
;
break
;
case
CUpdateConfig
::
ConfigChangeType
::
shutdown
:
shutdown
(
);
break
;
default:
default:
ITA_EXCEPT_INVALID_PARAMETER
(
"Unkown type of config change"
);
ITA_EXCEPT_INVALID_PARAMETER
(
"Unkown type of config change"
);
}
}
...
@@ -353,5 +356,18 @@ namespace ITA
...
@@ -353,5 +356,18 @@ namespace ITA
{
{
return
m_pFilterNetwork
.
get
(
);
return
m_pFilterNetwork
.
get
(
);
}
}
void
CScheduler
::
shutdown
()
{
m_qUpdateQueue
.
clear
(
);
m_lPendingUpdateList
.
clear
(
);
m_lUpdateList
.
clear
(
);
// signal the reset to the workers
for
(
auto
&
worker
:
m_vWorker
)
{
worker
->
shutdown
(
);
}
}
}
// namespace simulation_scheduler
}
// namespace simulation_scheduler
}
// namespace ITA
}
// namespace ITA
\ No newline at end of file
Write
Preview
Supports
Markdown
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