(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:
Ron Koenderink 2005-08-20 19:16:56 +00:00
parent 22456c4965
commit ef0dbf6790
3 changed files with 17 additions and 9 deletions

View file

@ -51,5 +51,6 @@ void player_kill_idle(void *);
void update_main(void *); void update_main(void *);
void update_sched(void *); void update_sched(void *);
void shutdown_sequence(void *); void shutdown_sequence(void *);
void update_force(void *);
#endif #endif

View file

@ -41,8 +41,7 @@
int int
force(void) force(void)
{ {
int seconds; static int seconds;
time_t now;
if (update_pending) { if (update_pending) {
pr("Update is pending\n"); pr("Update is pending\n");
@ -59,12 +58,9 @@ force(void)
seconds = onearg(player->argp[1], "Time until update [in seconds]? "); seconds = onearg(player->argp[1], "Time until update [in seconds]? ");
if (seconds < 0) if (seconds < 0)
return RET_FAIL; return RET_FAIL;
if (seconds) {
time(&now); pr("Scheduling update in %d second(s)\n", seconds);
pr("Waiting %d seconds...\n", seconds); empth_create(PP_SCHED, update_force, (50 * 1024), 0, "forceUpdate",
empth_sleep(now + seconds); "Schedules an update", &seconds);
}
pr("Scheduling update now\n");
empth_sem_signal(update_sem);
return RET_OK; return RET_OK;
} }

View file

@ -97,6 +97,17 @@ update_sched(void *unused)
/*NOTREACHED*/ /*NOTREACHED*/
} }
void
update_force(void *seconds)
{
time_t now;
time(&now);
empth_sleep(now + *(int *)seconds);
empth_sem_signal(update_sem);
empth_exit();
}
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
update_wait(void *unused) update_wait(void *unused)