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. How to force the run() function to execute first
Forum Updated to NodeBB v4.3 + New Features

How to force the run() function to execute first

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 590 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.
  • N Offline
    N Offline
    nitks.abhinav
    wrote on last edited by
    #1

    Hi ,
    I have below code where I see that the run function of the clientThread runs after the serverConnect() function. How can I force the run() function to execute first before serverConnect.

    Thank you,

        clientThread->start();  
    
        /* Connect to the notification server. */
        clientThread->serverConnect();
    
    
    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      This should work:

      QTimer::singleShot(0, []() { clientThread->serverConnect() } );
      

      Or, if serverConnect() is a slot:

      QTimer::singleShot(0, clientThread, &ClientThread::serverConnect());
      

      (Z(:^

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nitks.abhinav
        wrote on last edited by
        #3

        I used the started SIGNAL and called serverConnect in SLOT function.

        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