[prev in list] [next in list] [prev in thread] [next in thread]
List: xerces-cvs
Subject: cvs commit: xml-xerces/c/tests/ThreadTest ThreadTest.cpp
From: tng () apache ! org
Date: 2002-02-26 14:24:51
[Download RAW message or body]
tng 02/02/26 06:24:51
Modified: c/tests/ThreadTest ThreadTest.cpp
Log:
Use fInProgress instead of fHeartBeat to determine if a thread is done or not.
Revision Changes Path
1.18 +25 -29 xml-xerces/c/tests/ThreadTest/ThreadTest.cpp
Index: ThreadTest.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/tests/ThreadTest/ThreadTest.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ThreadTest.cpp 25 Feb 2002 21:34:39 -0000 1.17
+++ ThreadTest.cpp 26 Feb 2002 14:24:50 -0000 1.18
@@ -55,7 +55,7 @@
*/
/*
- * $Id: ThreadTest.cpp,v 1.17 2002/02/25 21:34:39 tng Exp $
+ * $Id: ThreadTest.cpp,v 1.18 2002/02/26 14:24:50 tng Exp $
*
* @author Andy Heninger, IBM
*/
@@ -247,10 +247,12 @@
{
bool fHeartBeat; // Set true by the thread each time it finishes
// parsing a file.
+ bool fInProgress; // Set to false by the thread when parse in progress
unsigned int fParses; // Number of parses completed.
int fThreadNum; // Identifying number for this thread.
ThreadInfo() {
fHeartBeat = false;
+ fInProgress = false;
fParses = 0;
fThreadNum = -1;
}
@@ -965,6 +967,7 @@
" -v Use validating parser. Non-validating is default.\n"
" -n Enable namespace processing. Defaults to off.\n"
" -s Enable schema processing. Defaults to off.\n"
+ " -f Enable full schema constraint checking. Defaults to off.\n"
" -parser=xxx Parser Type [dom | idom | sax]. Default is SAX.\n"
" -quiet Suppress periodic status display.\n"
" -verbose Display extra messages.\n"
@@ -972,7 +975,7 @@
" -threads nnn Number of threads. Default is 2.\n"
" -time nnn Total time to run, in seconds. Default is forever.\n"
" -dump Dump DOM tree on error.\n"
- " -mem Read files into memory once only, and parse them from there.\n"
+ " -mem Read files into memory once only, and parse them from there.\n\n"
);
exit(1);
}
@@ -1070,14 +1073,8 @@
//
while (gRunInfo.stopNow == false)
{
- //
- // wait until my heartbeat is set to false
- //
- while (true) {
- if (thInfo->fHeartBeat == false)
- break;
- }
+ thInfo->fInProgress = true;
if (thParser == 0)
thParser = new ThreadParser;
@@ -1124,6 +1121,7 @@
thInfo->fHeartBeat = true;
thInfo->fParses++;
+ thInfo->fInProgress = false;
}
delete thParser;
@@ -1245,28 +1243,24 @@
while (gRunInfo.totalTime == 0 || gRunInfo.totalTime > elapsedSeconds)
{
ThreadFuncs::Sleep(1000);
-
- char c = '+';
- int threadNum;
- for (threadNum=0; threadNum < gRunInfo.numThreads; threadNum++)
- {
- if (gThreadInfo[threadNum].fHeartBeat == false)
- {
- c = '.';
- break;
- };
- }
-
if (gRunInfo.quiet == false && gRunInfo.verbose == false)
{
+ char c = '+';
+ int threadNum;
+ for (threadNum=0; threadNum < gRunInfo.numThreads; threadNum++)
+ {
+ if (gThreadInfo[threadNum].fHeartBeat == false)
+ {
+ c = '.';
+ break;
+ };
+ }
fputc(c, stdout);
fflush(stdout);
+ if (c == '+')
+ for (threadNum=0; threadNum < gRunInfo.numThreads; threadNum++)
+ gThreadInfo[threadNum].fHeartBeat = false;
}
-
- if (c == '+')
- for (threadNum=0; threadNum < gRunInfo.numThreads; threadNum++)
- gThreadInfo[threadNum].fHeartBeat = false;
-
elapsedSeconds = (XMLPlatformUtils::getCurrentMillis() - startTime) / 1000;
};
@@ -1280,7 +1274,7 @@
// Make sure all threads are done before terminate
//
for (threadNum=0; threadNum < gRunInfo.numThreads; threadNum++) {
- while (gThreadInfo[threadNum].fHeartBeat == false) {
+ while (gThreadInfo[threadNum].fInProgress == true) {
ThreadFuncs::Sleep(1000);
}
if (gRunInfo.verbose)
@@ -1298,8 +1292,10 @@
// printf("%f ", totalParsesCompleted);
}
- double parsesPerMinute = totalParsesCompleted / (double(gRunInfo.totalTime) / double(60));
- printf("\n%8.1f parses per minute.", parsesPerMinute);
+ if (gRunInfo.quiet == false) {
+ double parsesPerMinute = totalParsesCompleted / (double(gRunInfo.totalTime) / double(60));
+ printf("\n%8.1f parses per minute.\n", parsesPerMinute);
+ }
XMLPlatformUtils::Terminate();
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic