@@ -100,7 +100,7 @@ void PABotBase::stop(std::string error_message){
100100 }
101101
102102 if (!error_message.empty ()){
103- ReadSpinLock lg (m_state_lock);
103+ ReadSpinLock lg (m_state_lock, " PABotBase::stop() " );
104104 m_error_message = std::move (error_message);
105105 }
106106
@@ -155,15 +155,15 @@ void PABotBase::wait_for_all_requests(Cancellable* cancelled){
155155 cancelled->throw_if_cancelled ();
156156 }
157157 if (m_state.load (std::memory_order_acquire) != State::RUNNING){
158- ReadSpinLock lg0 (m_state_lock);
158+ ReadSpinLock lg0 (m_state_lock, " PABotBase::wait_for_all_requests() - 0 " );
159159 throw InvalidConnectionStateException (m_error_message);
160160 }
161161 if (m_error.load (std::memory_order_acquire)){
162- ReadSpinLock lg0 (m_state_lock);
162+ ReadSpinLock lg0 (m_state_lock, " PABotBase::wait_for_all_requests() - 1 " );
163163 throw ConnectionException (&m_logger, m_error_message);
164164 }
165165 {
166- ReadSpinLock lg1 (m_state_lock, " PABotBase::wait_for_all_requests()" );
166+ ReadSpinLock lg1 (m_state_lock, " PABotBase::wait_for_all_requests() - 2 " );
167167#if 0
168168 m_logger.log(
169169 "Waiting for all requests to finish... (Requests: " +
@@ -434,7 +434,7 @@ void PABotBase::process_command_finished(BotBaseMessage message){
434434
435435 {
436436 std::lock_guard<std::mutex> lg0 (m_sleep_lock);
437- WriteSpinLock lg1 (m_state_lock, " PABotBase::process_command_finished() - 0 " );
437+ WriteSpinLock lg1 (m_state_lock, " PABotBase::process_command_finished()" );
438438
439439#ifdef INTENTIONALLY_DROP_MESSAGES
440440 if (rand () % 10 != 0 ){
@@ -510,7 +510,7 @@ void PABotBase::on_recv_message(BotBaseMessage message){
510510 }
511511 const pabb_MsgInfoInvalidType* params = (const pabb_MsgInfoInvalidType*)message.body .c_str ();
512512 {
513- WriteSpinLock lg (m_state_lock);
513+ WriteSpinLock lg (m_state_lock, " PABotBase::on_recv_message() - 0 " );
514514 m_error_message = " PABotBase incompatibility. Device does not recognize message type: " + std::to_string (params->type );
515515 m_logger.log (m_error_message, COLOR_RED);
516516 }
@@ -528,7 +528,7 @@ void PABotBase::on_recv_message(BotBaseMessage message){
528528 const pabb_MsgInfoMissedRequest* params = (const pabb_MsgInfoMissedRequest*)message.body .c_str ();
529529 if (params->seqnum == 1 ){
530530 {
531- WriteSpinLock lg (m_state_lock);
531+ WriteSpinLock lg (m_state_lock, " PABotBase::on_recv_message() = 1 " );
532532 m_error_message = " Serial connection has been interrupted." ;
533533 m_logger.log (m_error_message, COLOR_RED);
534534 }
@@ -543,7 +543,7 @@ void PABotBase::on_recv_message(BotBaseMessage message){
543543 case PABB_MSG_ERROR_DISCONNECTED:{
544544 m_logger.log (" The console has disconnected the controller." , COLOR_RED);
545545 {
546- WriteSpinLock lg (m_state_lock);
546+ WriteSpinLock lg (m_state_lock, " PABotBase::on_recv_message() - 2 " );
547547 m_error_message = " Disconnected by console." ;
548548 }
549549 m_error.store (true , std::memory_order_release);
@@ -839,11 +839,11 @@ uint64_t PABotBase::issue_request(
839839 cancelled->throw_if_cancelled ();
840840 }
841841 if (m_state.load (std::memory_order_acquire) != State::RUNNING){
842- ReadSpinLock lg0 (m_state_lock);
842+ ReadSpinLock lg0 (m_state_lock, " PABotBase::issue_request() - 0 " );
843843 throw InvalidConnectionStateException (m_error_message);
844844 }
845845 if (m_error.load (std::memory_order_acquire)){
846- ReadSpinLock lg0 (m_state_lock);
846+ ReadSpinLock lg0 (m_state_lock, " PABotBase::issue_request() - 1 " );
847847 throw ConnectionException (&m_logger, m_error_message);
848848 }
849849 cv_wait (cancelled, lg);
@@ -884,11 +884,11 @@ uint64_t PABotBase::issue_command(
884884 cancelled->throw_if_cancelled ();
885885 }
886886 if (m_state.load (std::memory_order_acquire) != State::RUNNING){
887- ReadSpinLock lg0 (m_state_lock);
887+ ReadSpinLock lg0 (m_state_lock, " PABotBase::issue_command() - 0 " );
888888 throw InvalidConnectionStateException (m_error_message);
889889 }
890890 if (m_error.load (std::memory_order_acquire)){
891- ReadSpinLock lg0 (m_state_lock);
891+ ReadSpinLock lg0 (m_state_lock, " PABotBase::issue_command() - 1 " );
892892 throw ConnectionException (&m_logger, m_error_message);
893893 }
894894 cv_wait (cancelled, lg);
0 commit comments