|
From: Hans D. <dul...@us...> - 2001-03-17 04:26:53
|
Update of /cvsroot/corelinux/corelinux/src/classlibs/corelinux
In directory usw-pr-cvs1:/tmp/cvs-serv8623
Modified Files:
Thread.cpp
Log Message:
Added CreatedCount and BlockedCount.
Index: Thread.cpp
===================================================================
RCS file: /cvsroot/corelinux/corelinux/src/classlibs/corelinux/Thread.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** Thread.cpp 2000/11/02 12:32:01 1.16
--- Thread.cpp 2001/03/17 04:29:01 1.17
***************
*** 51,54 ****
--- 51,55 ----
ThreadMap Thread::theThreadMap;
+ Count Thread::theThreadCount (0);
// Default constructor
***************
*** 167,170 ****
--- 168,178 ----
}
+ // Get created thread count
+
+ Count Thread::getCreatedThreadCount( void )
+ {
+ return theThreadCount;
+ }
+
// Get active thread count
***************
*** 238,241 ****
--- 246,283 ----
}
+ // Get the blocked thread count
+
+ Count Thread::getBlockedThreadCount( void )
+ {
+ Guard myGuard( theThreadManager.instance()->access() );
+
+ //
+ // Setup the count and iterators outside the loop
+ //
+
+ Count aCount(0);
+ ThreadMapIterator begin( theThreadMap.begin() );
+ ThreadMapIterator end( theThreadMap.end() );
+
+ while( begin != end )
+ {
+ //
+ // Get the state and test for some state of inactiveness
+ //
+
+ if( (*begin).second->getState() == THREAD_WAITING_TO_START )
+ {
+ ++aCount;
+ }
+ else
+ {
+ ; // do nothing
+ }
+ ++begin;
+ }
+
+ return aCount;
+ }
+
// Test routine for collection
***************
*** 305,308 ****
--- 347,351 ----
{
theThreadMap[aThreadId] = aContextPtr;
+ theThreadCount++;
}
}
|