cec: send ping and bootloader commands via the output queue
authorLars Op den Kamp <lars@opdenkamp.eu>
Sat, 3 Dec 2011 21:37:15 +0000 (22:37 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Sun, 4 Dec 2011 02:28:20 +0000 (03:28 +0100)
src/lib/AdapterCommunication.cpp

index e6afcf463bae80fd0cacbf2f964090fa418caaed..314bfe50b1d1b6049fc974cc124d6dba7edc5c2a 100644 (file)
@@ -458,7 +458,9 @@ bool CAdapterCommunication::StartBootloader(void)
   output->push_escaped(MSGCODE_START_BOOTLOADER);
   output->push_back(MSGEND);
 
-  SendMessageToAdapter(output);
+  CLockObject lock(&output->mutex);
+  if (Write(output))
+    output->condition.Wait(&output->mutex);
   bReturn = output->state == ADAPTER_MESSAGE_STATE_SENT;
   delete output;
 
@@ -478,7 +480,9 @@ bool CAdapterCommunication::PingAdapter(void)
   output->push_escaped(MSGCODE_PING);
   output->push_back(MSGEND);
 
-  SendMessageToAdapter(output);
+  CLockObject lock(&output->mutex);
+  if (Write(output))
+    output->condition.Wait(&output->mutex);
   bReturn = output->state == ADAPTER_MESSAGE_STATE_SENT;
   delete output;