schedsvc: Add support for running missed tasks at the service start.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ae79454989
commit
8d540ec7cf
|
@ -1039,6 +1039,30 @@ void check_task_time(void)
|
|||
LeaveCriticalSection(&at_job_list_section);
|
||||
}
|
||||
|
||||
void check_missed_task_time(void)
|
||||
{
|
||||
FILETIME current_ft, last_ft;
|
||||
struct job_t *job;
|
||||
|
||||
GetSystemTimeAsFileTime(¤t_ft);
|
||||
FileTimeToLocalFileTime(¤t_ft, ¤t_ft);
|
||||
|
||||
EnterCriticalSection(&at_job_list_section);
|
||||
|
||||
LIST_FOR_EACH_ENTRY(job, &at_job_list, struct job_t, entry)
|
||||
{
|
||||
if (SystemTimeToFileTime(&job->data.last_runtime, &last_ft))
|
||||
{
|
||||
if (job_runs_at(job, &last_ft, ¤t_ft))
|
||||
{
|
||||
run_job(job);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&at_job_list_section);
|
||||
}
|
||||
|
||||
void remove_job(const WCHAR *name)
|
||||
{
|
||||
struct job_t *job;
|
||||
|
|
|
@ -31,6 +31,7 @@ void update_process_status(DWORD pid) DECLSPEC_HIDDEN;
|
|||
BOOL get_next_runtime(LARGE_INTEGER *rt) DECLSPEC_HIDDEN;
|
||||
void check_task_time(void) DECLSPEC_HIDDEN;
|
||||
void load_at_tasks(void) DECLSPEC_HIDDEN;
|
||||
void check_missed_task_time(void) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline WCHAR *heap_strdupW(const WCHAR *src)
|
||||
{
|
||||
|
|
|
@ -54,6 +54,7 @@ static DWORD WINAPI tasks_monitor_thread(void *arg)
|
|||
TRACE("Starting...\n");
|
||||
|
||||
load_at_tasks();
|
||||
check_missed_task_time();
|
||||
|
||||
htimer = CreateWaitableTimerW(NULL, FALSE, NULL);
|
||||
if (htimer == NULL)
|
||||
|
|
Loading…
Reference in New Issue