blocking connect()
-
Your program will block as long as display() does not return.
There is no need to do something special to block your program, even if it sounds strange why you want it to block. -
Your program will block as long as display() does not return.
There is no need to do something special to block your program, even if it sounds strange why you want it to block.@jsulm
I tested it, it doesnt block the program
emit display();
qDebug() << "Message received!";
output:
Message received!
contents of display() slotive search around while waiting for answers in this thread.
can you tell me the use of Qt::BlockingQueuedConnection?TIA
-
Emitting a signal in a single thread is basically calling a function, so it is blocking. The output you have can happen if "server" and "this" objects live in different threads. Is that the case?
Qt::BlockingQueuedConnection is only useful if sender and receiver live in different threads. It makes the sender block on emit until receiver executes the slot. In a single threaded execution this is how emit behaves out of the box.
-
Emitting a signal in a single thread is basically calling a function, so it is blocking. The output you have can happen if "server" and "this" objects live in different threads. Is that the case?
Qt::BlockingQueuedConnection is only useful if sender and receiver live in different threads. It makes the sender block on emit until receiver executes the slot. In a single threaded execution this is how emit behaves out of the box.
@Chris-Kawa
my sender and receiver is in different thread.
I see! you hit all the bullseye!
THanks guys!and i now understand the Qt::BlockingQueuedConnection