The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: ceeac on April 30, 2020, 05:48:51 PM

Title: Fix for data race in plans_finish_rd
Post by: ceeac on April 30, 2020, 05:48:51 PM
The read access to min_height and max_height at the beginning of karte_t::plans_finish_rd needs to be synchronized since another thread might be writing to any of these two variables.
Title: Re: Fix for data race in plans_finish_rd
Post by: Dwachs on May 01, 2020, 07:21:53 AM
Imho no mutex is needed. It would be sufficient to initialize those values with -128 and +127. The writing to min//max_height is already protected by some mutex.
Title: Re: Fix for data race in plans_finish_rd
Post by: ceeac on May 01, 2020, 08:38:44 AM
Yes, that would work too. :)
Title: Re: Fix for data race in plans_finish_rd
Post by: Dwachs on May 02, 2020, 09:43:26 AM
implemented in r9060