Is it written somewhere in documentation which HAL drivers are thread safe and which are not thread safe?
I have found in ADC HAL documentation such an information - it's written to be fast so it's not thread safe. But for the rest of the HAL drivers I can't found information in documentation. Does it means that all they are thread safe? I think PAL driver is also not thread safe or I'm wrong?
I understand that thread safe is a opposition of performance, so there is the reason to make a compromise with this. But maybe we should have clearly marked/noted which parts and functions of ChibiOS are not thread safe and take a care when work with them.
Excuse me if such an information is included or this question is discussed before. In this case - forward me to this topic or documentation, please.
Best Regards
Ceco
Thread safe drivers
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Thread safe drivers
Hi,
Very good point. Kernel functions are all safe by design, the HAL is different, I think that a "reentrant" or "non-reentrant" flag should be added to each function. I'll try to update the documentation system before the stable release.
Reworking the documentation is one of the tasks to be completed before 2.6.x, right now there are way too many manuals.
In general drivers with assertions checking the driver state are not reentrant.
Giovanni
Very good point. Kernel functions are all safe by design, the HAL is different, I think that a "reentrant" or "non-reentrant" flag should be added to each function. I'll try to update the documentation system before the stable release.
Reworking the documentation is one of the tasks to be completed before 2.6.x, right now there are way too many manuals.
In general drivers with assertions checking the driver state are not reentrant.
Giovanni