Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux RT Preempt - Are POSIX threads required?

I've read through this example and browsed through this wiki regarding real-time application development with a PREEMPT patched kernel. The former uses POSIX threads and the latter only references the need for PTHREAD_PRIO_INHERIT mutexes.

So I haven't seen anything that says I explicitly need POSIX threads to take advantage of the PREEMPT patch, but it seems suggested in a way. Would I still receive the benefit of the PREEMPT patch if I implemented native C++11 threads or boost threads?

Thanks

like image 895
DrTarr Avatar asked Nov 30 '25 06:11

DrTarr


1 Answers

Late answer, but still...

On Linux (and other Unix systems) C++ std threads are often implemented on top of pthreads. The C++ interface is often much more type safe and convenient, but for some things you need the raw Posix interface. For example, priority inheritance mutexes, and some thread scheduling settings, are not (yet, at least) available with std::threads. I have sometimes cheated and mixed Posix primitives and the std::thread primitives, it has worked for me.

like image 51
Erik Alapää Avatar answered Dec 02 '25 02:12

Erik Alapää



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!