Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. DirectConnection / QueuedConnection : Parallel Execution Problem
Forum Updated to NodeBB v4.3 + New Features

DirectConnection / QueuedConnection : Parallel Execution Problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
queuedconnectiosignal & slot
3 Posts 3 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    After
    wrote on last edited by After
    #1

    Hello,

    I am looking for a slot, under Qt, that can not be run multiple times in parallel, even if simultaneous reception of signals that could trigger it. I understood that the QueuedConnection parameter prevented multiple executions of the same slot, forcing the end of the execution of the slot before launching a new instance corresponding to a new signal then stored temporarily in an event queue . But even with QueuedConnection, I get parallel executions of the slot, yet in one thread.

    server = new QTcpServer(this);
    server->listen(QHostAddress::Any, 50885);
    connect(server, SIGNAL(newConnection()), this, SLOT(new_connection()), Qt::BlockingQueuedConnection);
    

    When I use BlockingQueuedConnection, I get the following message, and the signal does not call the slot:

    Qt: Dead lock detected while activating a BlockingQueuedConnection: Sender is QTcpServer(0x2392018), receiver is Machine(0x23336a8)
    

    Do you have any idea how to force linear, non-simultaneous executions? And if you have elements of understanding that allow me to better understand the operation of the last parameter of connect (), it is willingly :)

    Thank you beforehand

    JonBJ 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      What exactly do you want to achieve with your application ?

      The connection types are all explained in the documentation here.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • A After

        Hello,

        I am looking for a slot, under Qt, that can not be run multiple times in parallel, even if simultaneous reception of signals that could trigger it. I understood that the QueuedConnection parameter prevented multiple executions of the same slot, forcing the end of the execution of the slot before launching a new instance corresponding to a new signal then stored temporarily in an event queue . But even with QueuedConnection, I get parallel executions of the slot, yet in one thread.

        server = new QTcpServer(this);
        server->listen(QHostAddress::Any, 50885);
        connect(server, SIGNAL(newConnection()), this, SLOT(new_connection()), Qt::BlockingQueuedConnection);
        

        When I use BlockingQueuedConnection, I get the following message, and the signal does not call the slot:

        Qt: Dead lock detected while activating a BlockingQueuedConnection: Sender is QTcpServer(0x2392018), receiver is Machine(0x23336a8)
        

        Do you have any idea how to force linear, non-simultaneous executions? And if you have elements of understanding that allow me to better understand the operation of the last parameter of connect (), it is willingly :)

        Thank you beforehand

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @After
        For the reason why Qt::BlockingQueuedConnection does not work for you and gives you the error message, from the manual page @SGaist references:

        Same as Qt::QueuedConnection, except that the signalling thread blocks until the slot returns. This connection must not be used if the receiver lives in the signalling thread, or else the application will deadlock.

        It's for use across different threads for emitter/receiver, only.

        1 Reply Last reply
        2

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved