-
-
Notifications
You must be signed in to change notification settings - Fork 7k
POSIX Threads for Arduino #5914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
IMO that will be really incredibly awesome! |
I am really curious why not everybody round here is cheering for joy in anticipation of getting a reliable, worldwide tested and approved pre-emptive multithreading lib already running successfully on either C/C++ platform! |
Just because you may have a "worldwide tested and approved pre-emptive multithreading lib" doesn't mean the huge ecosystem of other libraries will work in a multithreaded environment. In fact, the vast majority use static data or other techniques that will randomly & intermittently fail if accessed from multiple preemptively scheduled threads. Even if all those problems are solved, multi-threaded programming is difficult work. Race conditions, deadlocks and other pitfalls await anyone trying to build their own inter-thread communication or synchronization code, even if using a well known API like pthreads. Preemptive threading is a powerful tool. Amazing things can be done with threads in the hands of the right people. But it's not a cure-all. Especially for novices, preemptive scheduling is a very sharp double-edged sword which should be wielded with caution. |
@PaulStoffregen Thanks for your comment. I forgot to motivate why I closed this issue/proposal. Your comment is very much to the point. I can only agree. The Scheduler (pthreads) risks opening a can-of-worms too large to handle. The current Arduino core(s) needs refactoring before this becomes feasible. |
I agree. If once being established, it has to run reliably. |
There has been some questions about AVR implementation of the Scheduler. I have made available a portable Scheduler implementation which work on AVR, SAM, SAMD, Teensy, etc. https://github.com/mikaelpatel/Arduino-Scheduler.
There has also been a discussion about extending the Scheduler functionality. This has brought me to the conclusion that a possible way forward is to implement a sub-set of the POSIX Thread API for Arduino (pthreads). See mikaelpatel/Arduino-Scheduler#13.
If there is an interest I could make time to do some work on this.
The text was updated successfully, but these errors were encountered: