wpilibsuite/allwpilib
Document thread safety guarantees of HAL SerialPort initialization
Open
#2,035 opened on Nov 3, 2019
component: halgood first issuetype: docs
Repository metrics
- Stars
- (1,281 stars)
- PR merge metrics
- (Avg merge 8d 11h) (153 merged PRs in 30d)
Description
I'm not sure anyone is actually using serial ports from multiple threads, but given that most things in the HAL seem to be written in a way that tries to be thread-safe, I'm assuming that the calls to, e.g., HAL_InitializeSerialPort and HAL_CloseSerial and all the other serial calls defined in hal/src/main/native/athena/SerialPort.cpp are intended to be safe to call from multiple threads.
Currently, after any of the calls to serialPortHandles->Get, there is no longer a mutex protecting access to the SerialPort.