There are few operations that are real-time safe for traditional OSes but are not under Xenomai, for example accessing system timers, few thread operations, etc.
For those purposes, we created the TWINE library, which also offers a high-level Worker Pool abstraction for exploiting multiple cores from inside a single plugin:
TWINE is also used internally by SUSHI and can be compiled for POSIX systems like traditional Linux and macOS.
Is there any documentation for the thread functions in TWINE? I am getting my information by reading
the public header has full Doxygen comments on all the methods, isn’t that enough?
This file has been truncated.
* Copyright 2018-2019 Modern Ancient Instruments Networked AB, dba Elk
* Twine is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
* Twine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with Twine.
* If not, see http://www.gnu.org/licenses/ .
It’s a pretty simple worker pool scheme, you create workers and pass callback + data pointer to each one of them. You can also look at how it’s used inside SUSHI for other use cases.
OK, so we never need to call __cobalt_pthread_create() or __cobalt_pthread_join()?
If that is true, it seems pretty simple.
No. The whole point of the library is to abstract away those things for you. TWINE has a fallback implementation (using standard POSIX threads) that can be used for normal Linux and some people have used it successfully on macOS, too.