2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/mm/mpw.c
5 * PURPOSE: Writes data that has been modified in memory but not on
8 * PROGRAMMERS: David Welch (welch@cwcom.net)
11 /* INCLUDES ****************************************************************/
17 /* GLOBALS *******************************************************************/
19 HANDLE MpwThreadHandle
;
20 static CLIENT_ID MpwThreadId
;
21 KEVENT MpwThreadEvent
;
22 BOOLEAN MpwThreadShouldTerminate
;
24 /* FUNCTIONS *****************************************************************/
27 MmMpwThreadMain(PVOID Ignored
)
31 LARGE_INTEGER Timeout
;
33 Timeout
.QuadPart
= -50000000;
37 Status
= KeWaitForSingleObject(&MpwThreadEvent
,
42 if (!NT_SUCCESS(Status
))
44 DbgPrint("MpwThread: Wait failed\n");
45 KeBugCheck(MEMORY_MANAGEMENT
);
46 return(STATUS_UNSUCCESSFUL
);
48 if (MpwThreadShouldTerminate
)
50 DbgPrint("MpwThread: Terminating\n");
51 return(STATUS_SUCCESS
);
56 CcRosFlushDirtyPages(128, &PagesWritten
);
67 MpwThreadShouldTerminate
= FALSE
;
68 KeInitializeEvent(&MpwThreadEvent
, SynchronizationEvent
, FALSE
);
70 Status
= PsCreateSystemThread(&MpwThreadHandle
,
75 (PKSTART_ROUTINE
) MmMpwThreadMain
,
77 if (!NT_SUCCESS(Status
))
83 NtSetInformationThread(MpwThreadHandle
,
88 return(STATUS_SUCCESS
);
96 OBJECT_ATTRIBUTES ObjectAttributes
;
99 /* Create the thread */
100 InitializeObjectAttributes(&ObjectAttributes
, NULL
, 0, NULL
, NULL
);
101 Status
= PsCreateSystemThread(&ThreadHandle
,
109 /* Close the handle and return status */
110 ZwClose(ThreadHandle
);