(update_running): New.
(update_run): Set it. Replace incorrect uses of update_pending by update_running, fixing buggy behavior while the update was trying to gain control: (sct_do_upd_mob, shp_do_upd_mob, lnd_do_upd_mob, pln_do_upd_mob): MOB_ACCESS mobility update was skipped. (telegram_is_new): Fix recognition of new telegrams by timestamp. (wu): Bulletins got misfiled as production reports. (shp_nav): Sail path got ignored. (setrel): Declaration of war failed silently with SLOW_WAR enabled. Messages got suppressed. (PR, mpr): Messages got misdirected to bulletins.
This commit is contained in:
parent
c1a0a42024
commit
e9cfbdc241
7 changed files with 33 additions and 14 deletions
|
@ -50,14 +50,31 @@
|
|||
|
||||
#define UPDATES 16
|
||||
|
||||
/*
|
||||
* Lock to synchronize player threads with the update.
|
||||
* Update takes it exclusive, commands take it shared.
|
||||
*/
|
||||
empth_rwlock_t *update_lock;
|
||||
static empth_t *update_thread;
|
||||
|
||||
/*
|
||||
* Update is pending, player threads must give up update_lock ASAP.
|
||||
* This means they must not block while update_pending.
|
||||
*/
|
||||
int update_pending;
|
||||
|
||||
/*
|
||||
* Update is running.
|
||||
* Can be used to suppress messages, or direct them to bulletins.
|
||||
*/
|
||||
int update_running;
|
||||
|
||||
time_t update_time[UPDATES];
|
||||
|
||||
static time_t update_schedule_anchor;
|
||||
static int update_wanted;
|
||||
|
||||
static empth_t *update_thread;
|
||||
|
||||
static int update_get_schedule(void);
|
||||
static void update_sched(void *);
|
||||
static void update_run(void);
|
||||
|
@ -209,8 +226,9 @@ update_run(void)
|
|||
return;
|
||||
}
|
||||
}
|
||||
update_running = 1;
|
||||
update_main();
|
||||
update_pending = 0;
|
||||
update_pending = update_running = 0;
|
||||
empth_rwlock_unlock(update_lock);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue