Enabled saver thread.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@540 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Phipps 2002-07-30 02:02:40 +00:00
parent fbafb4de2b
commit 1314ca6a7f
3 changed files with 22 additions and 7 deletions

View File

@ -44,6 +44,7 @@ int main(int argc,char **argv)
for (int i=0;i<8192;i++)
if (i%256!=readByte(i))
printf ("ERROR! Byte at offset %d does not match: expected: %d, found: %d\n",i,i%256,readByte(i));
snooze(2000000);
return 0;
}

View File

@ -6,6 +6,12 @@ areaManager am;
swapFileManager swapMan;
pageManager pageMan(10); // Obviously this hard coded number is a hack...
areaManager *vmInterface::getAM(void)
{
// Normally, we would go to the current user process to get this. Since there no such thing exists here...
return &am;
}
int32 cleanerThread(void *pageMan)
{
pageManager *pm=(pageManager *)pageMan;
@ -13,16 +19,22 @@ int32 cleanerThread(void *pageMan)
return 0;
}
int32 saverThread(void *areaMan)
{
areaManager *am=(areaManager *)areaMan;
// This should iterate over all processes...
while (1)
{
snooze(250000);
am->saver();
}
}
vmInterface::vmInterface(int pages)
{
nextAreaID=0;
resume_thread(spawn_thread(cleanerThread,"cleanerThread",0,&pageMan));
}
areaManager *vmInterface::getAM(void)
{
// Normally, we would go to the current user process to get this. Since there no such thing exists here...
return &am;
resume_thread(spawn_thread(saverThread,"saverThread",0,getAM()));
}
int vmInterface::getAreaByAddress(void *address)

View File

@ -126,5 +126,7 @@ void vpage::pager(int desperation)
void vpage::saver(void)
{
flush();
if (dirty)
flush();
dirty=false;
}