Start and restart SendToMon ok
This commit is contained in:
parent
9adc001ccf
commit
15772bb420
1 changed files with 19 additions and 7 deletions
|
@ -324,10 +324,11 @@ void Tasks::SendToMonTask(void* arg) {
|
|||
bool kill_sendToMonOk=0;
|
||||
|
||||
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
|
||||
// Synchronization barrier (waiting that all tasks are starting)
|
||||
rt_sem_p(&sem_barrier, TM_INFINITE);
|
||||
|
||||
//while(1){
|
||||
while(1){
|
||||
// Synchronization barrier (waiting that all tasks are starting)
|
||||
rt_sem_p(&sem_barrier, TM_INFINITE);
|
||||
|
||||
|
||||
/**************************************************************************************/
|
||||
/* The task sendToMon starts here */
|
||||
|
@ -335,6 +336,7 @@ void Tasks::SendToMonTask(void* arg) {
|
|||
rt_sem_p(&sem_serverOk, TM_INFINITE);
|
||||
|
||||
//Initialize the loop condition
|
||||
kill_sendToMonOk=0;
|
||||
rt_mutex_acquire(&mutex_killSendMon, TM_INFINITE);
|
||||
killSendMon=0; // The message is deleted with the Write
|
||||
rt_mutex_release(&mutex_killSendMon);
|
||||
|
@ -352,7 +354,9 @@ void Tasks::SendToMonTask(void* arg) {
|
|||
rt_mutex_release(&mutex_killSendMon);
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
cout << "SendToMon Task dies" << endl << flush;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -400,7 +404,9 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
|||
|
||||
rt_mutex_acquire(&mutex_killSendMon, TM_INFINITE);
|
||||
killSendMon=1;
|
||||
rt_mutex_release(&mutex_killSendMon);
|
||||
rt_mutex_release(&mutex_killSendMon);
|
||||
//Write fake message in queue to unblock Read function
|
||||
WriteInQueue(&q_messageToMon, new Message(MESSAGE_EMPTY));
|
||||
|
||||
rt_mutex_acquire(&mutex_killBattery, TM_INFINITE);
|
||||
killBattery=1;
|
||||
|
@ -413,7 +419,13 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
|||
rt_mutex_acquire(&mutex_acquireImage, TM_INFINITE);
|
||||
acquireImage=0;
|
||||
rt_mutex_release(&mutex_acquireImage);
|
||||
|
||||
|
||||
//close Monitor
|
||||
monitor.Close();
|
||||
robot.Close();
|
||||
|
||||
sleep(2);
|
||||
|
||||
//Restart all the process
|
||||
Tasks::Join();
|
||||
//rt_sem_v(&sem_restart);
|
||||
|
@ -545,7 +557,7 @@ void Tasks::OpenComRobot(void *arg) {
|
|||
msgSend = new Message(MESSAGE_ANSWER_ACK);
|
||||
}
|
||||
WriteInQueue(&q_messageToMon, msgSend); // msgSend will be deleted by sendToMon
|
||||
|
||||
|
||||
//Trigger Detection of Communication Loss with Robot
|
||||
rt_sem_v(&sem_detectLostSupRob);
|
||||
|
||||
|
|
Loading…
Reference in a new issue