• R/O
  • SSH
  • HTTPS

nes: 提交


Commit MetaInfo

修订版364 (tree)
时间2007-12-04 16:11:21
作者okasaka

Log Message

(Process) : Fix process clean up procedure. Increment the process reference count for each thread.

更改概述

差异

--- es/trunk/os/kernel/port/process.cpp (revision 363)
+++ es/trunk/os/kernel/port/process.cpp (revision 364)
@@ -688,11 +688,12 @@
688688 return 0;
689689 }
690690
691- // Add this thread to this process and memorize the user stack address.
691+ // Add this thread to this process.
692692 ++threadCount;
693693 thread->process = this;
694694 thread->userStack = userStack;
695695 threadList.addLast(thread);
696+ addRef();
696697 return thread;
697698 }
698699
@@ -711,6 +712,8 @@
711712 threadList.remove(thread);
712713 --threadCount;
713714 waitPoint.wakeup();
715+
716+ release();
714717 }
715718
716719 IThread* Process::
@@ -908,17 +911,7 @@
908911
909912 exitValue = status;
910913
911- for (SyscallProxy* proxy(syscallTable);
912- proxy < &syscallTable[INTERFACE_POINTER_MAX];
913- ++proxy)
914- {
915- proxy->addRef();
916- while (0 < proxy->release())
917- ;
918- }
919-
920- // Cancel all the threads. Note do not release threads here as they are
921- // stored in syscallTable.
914+ // Cancel all the threads.
922915 Thread* thread;
923916 List<Thread, &Thread::linkProcess>::Iterator iter = threadList.begin();
924917 while ((thread = iter.next()))
@@ -948,7 +941,7 @@
948941 // NOT REACHED HERE
949942 }
950943
951- // Cancel all the threads
944+ // Cancel all the threads.
952945 Monitor::Synchronized method(monitor);
953946 Thread* thread;
954947 List<Thread, &Thread::linkProcess>::Iterator iter = threadList.begin();
@@ -956,9 +949,8 @@
956949 {
957950 ASSERT(thread != Thread::getCurrentThread());
958951 thread->setCancelState(ICurrentThread::CANCEL_ENABLE);
959- thread->setCancelType(ICurrentThread::CANCEL_ASYNCHRONOUS);
952+ thread->setCancelType(ICurrentThread::CANCEL_DEFERRED);
960953 thread->cancel();
961- thread->release();
962954 }
963955 }
964956
--- es/trunk/init/es.cpp (revision 363)
+++ es/trunk/init/es.cpp (revision 364)
@@ -178,10 +178,8 @@
178178 esCreateInstance(CLSID_FatFileSystem, IFileSystem::iid()));
179179 fatFileSystem->mount(disk);
180180 {
181- Handle<IContext> root;
181+ Handle<IContext> root = fatFileSystem->getRoot();
182182
183- root = fatFileSystem->getRoot();
184-
185183 nameSpace->bind("file", root);
186184
187185 // start event manager process.
@@ -205,12 +203,14 @@
205203 consoleProcess->kill();
206204 eventProcess->kill();
207205
208- freeSpace = fatFileSystem->getFreeSpace();
209- totalSpace = fatFileSystem->getTotalSpace();
210- esReport("Free space %lld, Total space %lld\n", freeSpace, totalSpace);
206+ esSleep(10000000);
211207 }
208+
209+ freeSpace = fatFileSystem->getFreeSpace();
210+ totalSpace = fatFileSystem->getTotalSpace();
211+ esReport("Free space %lld, Total space %lld\n", freeSpace, totalSpace);
212+
212213 fatFileSystem->dismount();
213214 fatFileSystem = 0;
214-
215215 esSleep(10000000);
216216 }
Show on old repository browser