update server: Move update_running from server/ to update/
update.h is a more logical home for update_running than server.h. Move the definition and the assignments along, from server/update.c to lib/update/main.c. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
dd9e393b38
commit
55be3c7105
11 changed files with 12 additions and 16 deletions
|
@ -40,7 +40,6 @@
|
||||||
extern int shutdown_pending;
|
extern int shutdown_pending;
|
||||||
extern empth_rwlock_t *update_lock;
|
extern empth_rwlock_t *update_lock;
|
||||||
extern empth_rwlock_t *shutdown_lock;
|
extern empth_rwlock_t *shutdown_lock;
|
||||||
extern int update_running;
|
|
||||||
extern time_t update_time[UPDATE_TIME_LEN];
|
extern time_t update_time[UPDATE_TIME_LEN];
|
||||||
|
|
||||||
void market_init(void);
|
void market_init(void);
|
||||||
|
|
|
@ -74,6 +74,7 @@ struct budget {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* main.c */
|
/* main.c */
|
||||||
|
extern int update_running;
|
||||||
extern struct budget nat_budget[MAXNOC];
|
extern struct budget nat_budget[MAXNOC];
|
||||||
|
|
||||||
/* age.c */
|
/* age.c */
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include "optlist.h"
|
#include "optlist.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "server.h"
|
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#include "plane.h"
|
#include "plane.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "server.h"
|
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "server.h"
|
#include "update.h"
|
||||||
#include "xy.h"
|
#include "xy.h"
|
||||||
|
|
||||||
static void pr_player(struct player *pl, int id, char *buf);
|
static void pr_player(struct player *pl, int id, char *buf);
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include "optlist.h"
|
#include "optlist.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "server.h"
|
#include "update.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
setrel(natid us, natid them, int rel)
|
setrel(natid us, natid them, int rel)
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "sect.h"
|
#include "sect.h"
|
||||||
#include "server.h"
|
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
#include "xy.h"
|
#include "xy.h"
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include "optlist.h"
|
#include "optlist.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "server.h"
|
|
||||||
#include "ship.h"
|
#include "ship.h"
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
|
|
@ -43,8 +43,8 @@
|
||||||
#include "optlist.h"
|
#include "optlist.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "server.h"
|
|
||||||
#include "tel.h"
|
#include "tel.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
static struct telstr last_tel[MAXNOC];
|
static struct telstr last_tel[MAXNOC];
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,12 @@
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update is running.
|
||||||
|
* Can be used to suppress messages, or direct them to bulletins.
|
||||||
|
*/
|
||||||
|
int update_running;
|
||||||
|
|
||||||
struct budget nat_budget[MAXNOC];
|
struct budget nat_budget[MAXNOC];
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -57,6 +63,7 @@ update_main(void)
|
||||||
int i;
|
int i;
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
|
|
||||||
|
update_running = 1;
|
||||||
logerror("production update (%d etus)", etu);
|
logerror("production update (%d etus)", etu);
|
||||||
getrusage(RUSAGE_SELF, &rus1);
|
getrusage(RUSAGE_SELF, &rus1);
|
||||||
game_record_update(time(NULL));
|
game_record_update(time(NULL));
|
||||||
|
@ -134,4 +141,5 @@ update_main(void)
|
||||||
- (rus1.ru_utime.tv_sec + rus1.ru_utime.tv_usec / 1e6),
|
- (rus1.ru_utime.tv_sec + rus1.ru_utime.tv_usec / 1e6),
|
||||||
rus2.ru_stime.tv_sec + rus2.ru_stime.tv_usec / 1e6
|
rus2.ru_stime.tv_sec + rus2.ru_stime.tv_usec / 1e6
|
||||||
- (rus1.ru_stime.tv_sec + rus1.ru_stime.tv_usec / 1e6));
|
- (rus1.ru_stime.tv_sec + rus1.ru_stime.tv_usec / 1e6));
|
||||||
|
update_running = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,12 +50,6 @@
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* Update is running.
|
|
||||||
* Can be used to suppress messages, or direct them to bulletins.
|
|
||||||
*/
|
|
||||||
int update_running;
|
|
||||||
|
|
||||||
static time_t update_schedule_anchor;
|
static time_t update_schedule_anchor;
|
||||||
static int update_wanted;
|
static int update_wanted;
|
||||||
|
|
||||||
|
@ -205,9 +199,7 @@ update_run(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update_running = 1;
|
|
||||||
update_main();
|
update_main();
|
||||||
update_running = 0;
|
|
||||||
empth_rwlock_unlock(update_lock);
|
empth_rwlock_unlock(update_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue