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

Odd looking locking semantics in Renderer::doRender

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.11.2, 5.12.0 Beta 2
    • Qt3D
    • None
    • All

    Description

      In qt3d\src\render\renderers\opengl\renderer\renderer.cpp:636 there is this code for scene3Dblocking mode (in Renderer::doRender):

      // Scene3D Blocking Mode
      if (scene3dBlocking && !queueIsComplete && !queueIsEmpty) {
          int i = 0;
          // We wait at most 10ms to avoid a case we could never recover from
          while (!queueIsComplete && i++ < 10) {
              QThread::msleep(1);
              qCDebug(Backend) << Q_FUNC_INFO << "Waiting for ready queue (try:" << i << "/ 10)";
              locker.unlock();
              queueIsComplete = m_renderQueue->isFrameQueueComplete();
              locker.relock();
          }
      }
      

      To me the locking and relocking of the renderQueue mutex (locker variable) seems strange. I think I would expect it to unlock before sleeping and relocking again before accessing m_renderQueue:

      // Scene3D Blocking Mode
      if (scene3dBlocking && !queueIsComplete && !queueIsEmpty) {
          int i = 0;
          // We wait at most 10ms to avoid a case we could never recover from
          while (!queueIsComplete && i++ < 10) {
              qCDebug(Backend) << Q_FUNC_INFO << "Waiting for ready queue (try:" << i << "/ 10)";
              locker.unlock();
              QThread::msleep(1);
              locker.relock();
              queueIsComplete = m_renderQueue->isFrameQueueComplete();
          }
      }
      

      Is there a more elaborate reason for it being like this? (I was thinking about making a patch but maybe i'm just stupid.. Sorry in advance if this is not an issue.)

       

      Attachments

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

        Activity

          People

            seanharmer Sean Harmer
            randominequalities randominequalities
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes