2020-04-08 16:13:49 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-04-08 16:13:49 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
|
|
|
#include <Kernel/Process.h>
|
2021-06-22 18:40:16 +03:00
|
|
|
#include <Kernel/Sections.h>
|
2020-04-08 16:13:49 +03:00
|
|
|
#include <Kernel/Tasks/SyncTask.h>
|
|
|
|
#include <Kernel/Time/TimeManagement.h>
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
2021-06-09 10:52:56 +03:00
|
|
|
UNMAP_AFTER_INIT void SyncTask::spawn()
|
2020-04-08 16:13:49 +03:00
|
|
|
{
|
2020-09-27 17:53:35 +03:00
|
|
|
RefPtr<Thread> syncd_thread;
|
2021-09-07 13:53:28 +03:00
|
|
|
Process::create_kernel_process(syncd_thread, KString::must_create("SyncTask"), [] {
|
2021-01-09 20:51:44 +03:00
|
|
|
dbgln("SyncTask is running");
|
2020-04-08 16:13:49 +03:00
|
|
|
for (;;) {
|
2021-07-11 01:26:17 +03:00
|
|
|
VirtualFileSystem::sync();
|
2021-02-28 01:56:16 +03:00
|
|
|
(void)Thread::current()->sleep(Time::from_seconds(1));
|
2020-04-08 16:13:49 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|