1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-26 06:53:14 +00:00

Terminate run when testing TTFF

This commit is contained in:
Carles Fernandez 2016-10-01 18:43:58 +02:00
parent c9ef673afa
commit b80eba91c8
2 changed files with 4 additions and 14 deletions

View File

@ -529,9 +529,10 @@ void ControlThread::sysv_queue_listener()
int msqid;
key_t key = 1102;
// wait for the queue to be created
while((msqid = msgget(key, 0644)) == -1){}
while(read_queue)
{
while((msqid = msgget(key, 0644)) == -1){}
if (msgrcv(msqid, &msg, msgrcv_size, 1, 0) != -1)
{

View File

@ -72,7 +72,7 @@ void receive_msg()
{
ttff_msgbuf msg;
ttff_msgbuf msg_stop;
msg_stop.mtype = 2;
msg_stop.mtype = 1;
msg_stop.ttff = 200;
double ttff_msg = 0.0;
int msgrcv_size = sizeof(msg.ttff);
@ -303,22 +303,15 @@ int main(int argc, char **argv)
// Create Sys V message queue to read TFFF measurements
key_t sysv_msg_key;
key_t sysv_stop_key;
int sysv_msqid;
int sysv_msqid_stop;
sysv_msg_key = 1101;
sysv_stop_key = 1102;
int msgflg = IPC_CREAT | 0666;
if ((sysv_msqid = msgget(sysv_msg_key, msgflg )) == -1)
{
std::cout<<"GNSS-SDR can not create message queues!" << std::endl;
throw new std::exception();
}
if ((sysv_msqid_stop = msgget(sysv_stop_key, msgflg )) == -1)
{
std::cout<<"GNSS-SDR can not create message queues!" << std::endl;
throw new std::exception();
}
// Start queue thread
std::thread receive_msg_thread(receive_msg);
@ -335,16 +328,12 @@ int main(int argc, char **argv)
// Terminate the queue thread
ttff_msgbuf msg;
//ttff_msgbuf msg_stop;
msg.mtype = 1;
msg.ttff = -1;
//msg_stop.mtype = 1;
//msg_stop.ttff = 200;
int msgsend_size;
msgsend_size = sizeof(msg.ttff);
msgsnd(sysv_msqid, &msg, msgsend_size, IPC_NOWAIT);
receive_msg_thread.join();
//msgsnd(sysv_msqid_stop, &msg_stop, msgsend_size, IPC_NOWAIT);
google::ShutDownCommandLineFlags();
return res;
}