I use a Qcoreapplication in the main function of a program. I have a sequence of communicating nodes which is read from a file (line by line). At each line, I call sendHello(src,dst). A simple description of the code is as follows:
file format:
node1 node2
node3 node4
node5 node6
int main()
{
Qcoreapplication app;
readfromfile();
app.exec()
}
readfromfile()
{
while(!eof())
sendhello(src,dst),
}
sendHello(src,dst)
{
// Here exchange different messages (more events)
sendmsg2(dst,src)
sendmsg3(src,dst)
}
int main()
{
Qcoreapplication app;
readfromfile();
app.exec()
}
readfromfile()
{
while(!eof())
sendhello(src,dst),
}
sendHello(src,dst)
{
// Here exchange different messages (more events)
sendmsg2(dst,src)
sendmsg3(src,dst)
}
To copy to clipboard, switch view to plain text mode
Calling each of this sendHello() by each pair, initiates different exchange of information (different events). I found out that the main loop goes from line to line (from pair to pair) and performs the sendHello for each pair sequentially.
Results I get:
sendHello(node1,node2)
sendHello(node3,node4)
sendmsg2(node2,node1)
sendmsg3(node1,node2)
sendmsg2(node4,node3)
sendmsg3(node2,node4)
I need to execute the events that are contained in each sendHello (sendmsg2 and sendmsg3) before moving to next lines (pairs). I tried to understand how to control the events of the main event loop, and how the middle events are scheduled but I did not.
Results I need:
sendHello(node1,node2)
sendmsg2(node2,node1)
sendmsg3(node1,node2)
sendHello(node3,node4)
sendmsg2(node4,node3)
sendmsg3(node2,node4)
I tried processevents( all events) but it`s not working as required. Don`t know why ?
Thanks in advance
Bookmarks