wpilibsuite/allwpilib
View on GitHubDocument 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
- (PR metrics pending)
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.