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;
|
bool kill_sendToMonOk=0;
|
||||||
|
|
||||||
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
|
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 */
|
/* The task sendToMon starts here */
|
||||||
|
@ -335,6 +336,7 @@ void Tasks::SendToMonTask(void* arg) {
|
||||||
rt_sem_p(&sem_serverOk, TM_INFINITE);
|
rt_sem_p(&sem_serverOk, TM_INFINITE);
|
||||||
|
|
||||||
//Initialize the loop condition
|
//Initialize the loop condition
|
||||||
|
kill_sendToMonOk=0;
|
||||||
rt_mutex_acquire(&mutex_killSendMon, TM_INFINITE);
|
rt_mutex_acquire(&mutex_killSendMon, TM_INFINITE);
|
||||||
killSendMon=0; // The message is deleted with the Write
|
killSendMon=0; // The message is deleted with the Write
|
||||||
rt_mutex_release(&mutex_killSendMon);
|
rt_mutex_release(&mutex_killSendMon);
|
||||||
|
@ -352,7 +354,9 @@ void Tasks::SendToMonTask(void* arg) {
|
||||||
rt_mutex_release(&mutex_killSendMon);
|
rt_mutex_release(&mutex_killSendMon);
|
||||||
|
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
|
cout << "SendToMon Task dies" << endl << flush;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -401,6 +405,8 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
||||||
rt_mutex_acquire(&mutex_killSendMon, TM_INFINITE);
|
rt_mutex_acquire(&mutex_killSendMon, TM_INFINITE);
|
||||||
killSendMon=1;
|
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);
|
rt_mutex_acquire(&mutex_killBattery, TM_INFINITE);
|
||||||
killBattery=1;
|
killBattery=1;
|
||||||
|
@ -414,6 +420,12 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
||||||
acquireImage=0;
|
acquireImage=0;
|
||||||
rt_mutex_release(&mutex_acquireImage);
|
rt_mutex_release(&mutex_acquireImage);
|
||||||
|
|
||||||
|
//close Monitor
|
||||||
|
monitor.Close();
|
||||||
|
robot.Close();
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
//Restart all the process
|
//Restart all the process
|
||||||
Tasks::Join();
|
Tasks::Join();
|
||||||
//rt_sem_v(&sem_restart);
|
//rt_sem_v(&sem_restart);
|
||||||
|
|
Loading…
Reference in a new issue