Serenity Operating System
at master 27 lines 684 B view raw
1/* 2 * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <Kernel/FileSystem/VirtualFileSystem.h> 8#include <Kernel/Process.h> 9#include <Kernel/Sections.h> 10#include <Kernel/Tasks/SyncTask.h> 11#include <Kernel/Time/TimeManagement.h> 12 13namespace Kernel { 14 15UNMAP_AFTER_INIT void SyncTask::spawn() 16{ 17 LockRefPtr<Thread> syncd_thread; 18 (void)Process::create_kernel_process(syncd_thread, KString::must_create("VFS Sync Task"sv), [] { 19 dbgln("VFS SyncTask is running"); 20 for (;;) { 21 VirtualFileSystem::sync(); 22 (void)Thread::current()->sleep(Time::from_seconds(1)); 23 } 24 }); 25} 26 27}