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