I have a GUI program , that has a QLocalServer inside , each time it got a connection from client , it will popup a dialog asking user what to do.
But when there’s multiple connection received simultaneously , a bunch of dialogs popus all together .. is there a way to queue them ?
I tried to use QMutex , but that stuck whole GUI thread.
What’s the common / correct solution to this ?
Just use a queue data structure, i.e. put the incoming connections into a queue data structure and then whenever a dialog is closed (say) check if there are more connections on the queue; if yes, process next one. When you get a connection in and the queue is empty process it immediately. QMutex blocks the GUI thread because most likely you haven’t spawned any additional threads, and it is actually a callback from QLocalServer and not a new thread that notifies you of an inbound connection.