Search code examples
cobalt

cobalt: When StorageManager calling destructor , there is task in last_change_timer_ or change_max_delay_timer_ ,it maybe be discarded


I found that StorageManager would call FinishIO and OnDestroy when it call destructor. It will wait sql_message_loop and savegame_thread_ completed in FinishIO, and reset resources include flush_on_last_change_timer_ and flush_on_change_max_delay_timer_. So if there is a task in flush_on_last_change_timer_ or flush_on_change_max_delay_timer_ when iStorageManager calling destructor, it maybe discard this task and lead to last savegame operate miss. Is it a problem or I don`t understand right.


Solution

  • Thanks for pointing this out. I believe that you are correct; it does appear that the last save can fail to occur if the StorageManager is destructed before the timer goes off. This will be fixed in later versions of Cobalt.