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