Menu

#276 QP/C/C++ POSIX port doesn't set thread priorities correctly

QP
closed
POSIX (3)
1
2024-08-01
2020-08-05
Anonymous
No

The QP/C/C++ POSIX port doesn't seem to set thread priorities correctly, they all run on the highes priority 99.

Looking at the manpages and qf_port.cpp, it looks like pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) is missing after pthread_attr_init(&attr) (line 226).
When not setting PTHREAD_EXPLICIT_SCHED, pthread_create() will by default inherit the attributes from the calling thread and not take the ones provided in attr. This is what seems to happen right now.
https://man7.org/linux/man-pages/man3/pthread_attr_setinheritsched.3.html

It's likely that this problem exists in the QP/C POSIX port too, as the relevant parts in the code are very similar. Same goes for the POSIX-QV ports.

Discussion

  • Quantum Leaps

    Quantum Leaps - 2020-08-05

    Thanks for reporting. The fix for this bug has been already pushed to the QP/C and QP/C++ git repos on GitHub and SourceForge. The bug fix will be included in the official upcoming QP/C/C++ release 6.8.4.
    --MMS

     

    Last edit: Quantum Leaps 2020-08-05
  • Anonymous

    Anonymous - 2020-08-06

    Thanks for the quick fix. The priorities are now set as expected.

     
  • Quantum Leaps

    Quantum Leaps - 2020-09-03
    • status: accepted --> closed
     
  • Quantum Leaps

    Quantum Leaps - 2020-09-03

    Fixed in QP/C and QP/C++ 6.9.0.
    --MMS

     

Anonymous
Anonymous

Add attachments
Cancel