bastibl / gr-rds

FM RDS/TMC Transceiver
http://en.wikipedia.org/wiki/Radio_Data_System
GNU General Public License v3.0
225 stars 73 forks source link

Parser and encoder use static variables to store state #87

Closed argilo closed 1 week ago

argilo commented 1 week ago

While working on #86, I noticed that the Parser and Encoder blocks use static variables in several places to store state. I got rid of some of them in that PR, but a few more remain:

https://github.com/bastibl/gr-rds/blob/670e2053d176b950787554e69f28b9d563335902/lib/parser_impl.cc#L386-L387

https://github.com/bastibl/gr-rds/blob/670e2053d176b950787554e69f28b9d563335902/lib/parser_impl.cc#L484

https://github.com/bastibl/gr-rds/blob/670e2053d176b950787554e69f28b9d563335902/lib/encoder_impl.cc#L410

This is problematic because static variables are shared across all instances, so the blocks will not work correctly if used in parallel. Instance variables should be used instead.