(force): Change to create update thread instead of calling
empth_sleep() as the empth_sleep() can not be aborted for an update. (update_force): New.
This commit is contained in:
parent
22456c4965
commit
ef0dbf6790
3 changed files with 17 additions and 9 deletions
|
@ -51,5 +51,6 @@ void player_kill_idle(void *);
|
|||
void update_main(void *);
|
||||
void update_sched(void *);
|
||||
void shutdown_sequence(void *);
|
||||
void update_force(void *);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -41,8 +41,7 @@
|
|||
int
|
||||
force(void)
|
||||
{
|
||||
int seconds;
|
||||
time_t now;
|
||||
static int seconds;
|
||||
|
||||
if (update_pending) {
|
||||
pr("Update is pending\n");
|
||||
|
@ -59,12 +58,9 @@ force(void)
|
|||
seconds = onearg(player->argp[1], "Time until update [in seconds]? ");
|
||||
if (seconds < 0)
|
||||
return RET_FAIL;
|
||||
if (seconds) {
|
||||
time(&now);
|
||||
pr("Waiting %d seconds...\n", seconds);
|
||||
empth_sleep(now + seconds);
|
||||
}
|
||||
pr("Scheduling update now\n");
|
||||
empth_sem_signal(update_sem);
|
||||
|
||||
pr("Scheduling update in %d second(s)\n", seconds);
|
||||
empth_create(PP_SCHED, update_force, (50 * 1024), 0, "forceUpdate",
|
||||
"Schedules an update", &seconds);
|
||||
return RET_OK;
|
||||
}
|
||||
|
|
|
@ -97,6 +97,17 @@ update_sched(void *unused)
|
|||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
void
|
||||
update_force(void *seconds)
|
||||
{
|
||||
time_t now;
|
||||
|
||||
time(&now);
|
||||
empth_sleep(now + *(int *)seconds);
|
||||
empth_sem_signal(update_sem);
|
||||
empth_exit();
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
update_wait(void *unused)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue