File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed
SerialPrograms/Source/CommonFramework/VideoPipeline Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -253,17 +253,16 @@ void VideoSession::internal_set_resolution(Resolution resolution){
253253}
254254
255255void VideoSession::run_commands (){
256- std::lock_guard <std::recursive_mutex > lg0 (m_reset_lock);
257- if (m_recursion_depth != 0 ){
256+ std::unique_lock <std::mutex > lg0 (m_reset_lock, std::defer_lock );
257+ if (!lg0. try_lock () ){
258258 m_logger.log (" Suppressing re-entrant command..." , COLOR_RED);
259259 return ;
260260 }
261- m_recursion_depth++;
262261 try {
263262 while (true ){
264263 Command command;
265264 {
266- WriteSpinLock lg (m_queue_lock);
265+ WriteSpinLock lg1 (m_queue_lock);
267266// cout << "VideoSession::run_commands(): " << m_queued_commands.size() << endl;
268267 if (m_queued_commands.empty ()){
269268 break ;
@@ -286,9 +285,7 @@ void VideoSession::run_commands(){
286285 break ;
287286 }
288287 }
289- m_recursion_depth--;
290288 }catch (...){
291- m_recursion_depth--;
292289 throw ;
293290 }
294291}
Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ class VideoSession
198198
199199
200200private:
201- mutable std::recursive_mutex m_reset_lock;
201+ mutable std::mutex m_reset_lock;
202202 mutable SpinLock m_state_lock;
203203// bool m_shutting_down = false;
204204
@@ -215,7 +215,6 @@ class VideoSession
215215 // We need to queue up all reset commands and run them on the main thread.
216216 // This is needed to prevent re-entrant calls from event processing.
217217 SpinLock m_queue_lock;
218- size_t m_recursion_depth = 0 ;
219218 std::deque<Command> m_queued_commands;
220219
221220 ListenerSet<StateListener> m_state_listeners;
You can’t perform that action at this time.
0 commit comments