Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-28947

QStateMachine: heigh load for waiting on events only

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.8.4, 5.0.0
    • Core: State Machine
    • None

    Description

      The code below does nothing than waiting for events but "eats" one processor core.

      QStateMachine machine;
      
      QState* parallel = new QState(QState::ParallelStates, &machine);
      machine.setInitialState(parallel);
      
      for (int i = 0; i < 10 * 1000; i++) {
          QState* group = new QState(parallel);
          QState* s1 = new QState(group);
          group->setInitialState(s1);
      }
      
      QEventLoop loop;
      connect(&machine, SIGNAL(finished()), &loop, SLOT(quit()));
      
      machine.start();
      loop.exec();
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            syntheticpp Peter Kümmel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes