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

Qt 6.x doesn't have thread naming feature for QThreads on VxWorks

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.8, 6.9
    • Core: Threads
    • None
    • VxWorks

    Description

      In 5.15 Qt VxWorks it is possible to set the threads name, it's missing from 6.x

      — /home/karim/Qt/5.15.14/Src/qtbase/src/corelib/thread/qthread_p.h
      +++ /home/karim/src/qt-everywhere-src-5.15.14-vx/qtbase/src/corelib/thread/qthread_p.h
      @@ -186,6 +186,10 @@

      #endif // Q_OS_UNIX

      +#ifdef Q_OS_VXWORKS
      + std::string name;
      +#endif // Q_OS_VXWORKS
      +
      #ifdef Q_OS_WIN
      static unsigned int __stdcall start(void *) noexcept;
      static void finish(void *, bool lockAnyway=true) noexcept;

      — /home/karim/Qt/5.15.14/Src/qtbase/src/corelib/thread/qthread_unix.cpp
      +++ /home/karim/src/qt-everywhere-src-5.15.14-vx/qtbase/src/corelib/thread/qthread_unix.cpp
      @@ -116,6 +116,13 @@

      static void destroy_current_thread_data(void *p)

      { +#if defined(Q_OS_VXWORKS_GNU) + // Calling setspecific(..., 0) sets the value to 0 for ALL threads. + // The 'set to 1' workaround adds a bit of an overhead though, + // since this function is called twice now. + if (p == (void *)1) + return; +#endif QThreadData *data = static_cast<QThreadData *>(p); // thread_local variables are set to zero before calling this destructor function, // if they are internally using pthread-specific data management, @@ -577,7 +584,7 @@ int prio_min; int prio_max; -#if defined(Q_OS_VXWORKS) && defined(VXWORKS_DKM) +#if defined(Q_OS_VXWORKS) // for other scheduling policies than SCHED_RR or SCHED_FIFO prio_min = SCHED_FIFO_LOW_PRI; prio_max = SCHED_FIFO_HIGH_PRI; @@ -686,6 +693,14 @@ return; }

      }
      +#if defined(Q_OS_VXWORKS)
      + if (Q_LIKELY(objectName().isEmpty()))
      + d->name = metaObject()->className();
      + else
      + d->name = objectName().toLocal8Bit().data();
      +
      + pthread_attr_setname(&attr, &d->name[0]);
      +#endif

      #ifdef Q_OS_INTEGRITY
      if (Q_LIKELY(objectName().isEmpty()))

      Attachments

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

        Activity

          People

            karimpinter Karim Pinter
            karimpinter Karim Pinter
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Jarno Lämsä Jarno Lämsä
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes