summaryrefslogtreecommitdiffstats
path: root/nsprpub/pr/src/cplus/tests
diff options
context:
space:
mode:
Diffstat (limited to 'nsprpub/pr/src/cplus/tests')
-rw-r--r--nsprpub/pr/src/cplus/tests/Makefile.in22
-rw-r--r--nsprpub/pr/src/cplus/tests/ranfile.cpp205
-rw-r--r--nsprpub/pr/src/cplus/tests/switch.cpp168
-rw-r--r--nsprpub/pr/src/cplus/tests/thread.cpp6
-rw-r--r--nsprpub/pr/src/cplus/tests/tpd.cpp57
5 files changed, 259 insertions, 199 deletions
diff --git a/nsprpub/pr/src/cplus/tests/Makefile.in b/nsprpub/pr/src/cplus/tests/Makefile.in
index c16423872..df4827656 100644
--- a/nsprpub/pr/src/cplus/tests/Makefile.in
+++ b/nsprpub/pr/src/cplus/tests/Makefile.in
@@ -49,24 +49,6 @@ LDOPTS = -L$(dist_libdir)
LIBPR = -lnspr$(MOD_MAJOR_VERSION)
LIBPL = -lplc$(MOD_MAJOR_VERSION)
-ifeq ($(OS_ARCH), IRIX)
- LDOPTS += -rpath $(PWD)/$(dist_libdir) -rdata_shared
- # For 6.x machines, include this flag
- ifeq ($(basename $(OS_RELEASE)),6)
- ifeq ($(USE_N32),1)
- LDOPTS += -n32
- else
- LDOPTS += -32
- endif
-
- ifeq ($(USE_PTHREADS), 1)
- ifeq ($(OS_RELEASE), 6.2)
- LDOPTS += -Wl,-woff,85
- endif
- endif
- endif
-endif
-
# Solaris
ifeq ($(OS_ARCH), SunOS)
ifdef NS_USE_GCC
@@ -103,10 +85,6 @@ ifneq ($(OS_ARCH), WINNT)
PWD = $(shell pwd)
endif
-ifeq ($(OS_ARCH), OSF1)
-LDOPTS += -rpath $(PWD)/$(dist_libdir)
-endif
-
ifeq ($(OS_ARCH), HP-UX)
LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
endif
diff --git a/nsprpub/pr/src/cplus/tests/ranfile.cpp b/nsprpub/pr/src/cplus/tests/ranfile.cpp
index c3ac0d3a4..0fb4c5d23 100644
--- a/nsprpub/pr/src/cplus/tests/ranfile.cpp
+++ b/nsprpub/pr/src/cplus/tests/ranfile.cpp
@@ -12,12 +12,12 @@
** Description: Test to hammer on various components of NSPR
** Modification History:
** 20-May-97 AGarcia- Converted the test to accomodate the debug_mode flag.
-** The debug mode will print all of the printfs associated with this test.
-** The regress mode will be the default mode. Since the regress tool limits
+** The debug mode will print all of the printfs associated with this test.
+** The regress mode will be the default mode. Since the regress tool limits
** the output to a one line status:PASS or FAIL,all of the printf statements
-** have been handled with an if (debug_mode) statement.
+** have been handled with an if (debug_mode) statement.
** 04-June-97 AGarcia removed the Test_Result function. Regress tool has been updated to
-** recognize the return code from tha main program.
+** recognize the return code from tha main program.
***********************************************************************/
@@ -46,19 +46,21 @@ class HammerData
{
public:
typedef enum {
- sg_go, sg_stop, sg_done} Action;
+ sg_go, sg_stop, sg_done
+ } Action;
typedef enum {
- sg_okay, sg_open, sg_close, sg_delete, sg_write, sg_seek} Problem;
+ sg_okay, sg_open, sg_close, sg_delete, sg_write, sg_seek
+ } Problem;
- virtual ~HammerData();
- HammerData(RCLock* lock, RCCondition *cond, PRUint32 clip);
+ virtual ~HammerData();
+ HammerData(RCLock* lock, RCCondition *cond, PRUint32 clip);
virtual PRUint32 Random();
Action action;
Problem problem;
PRUint32 writes;
RCInterval timein;
-friend class Hammer;
+ friend class Hammer;
private:
RCLock *ml;
RCCondition *cv;
@@ -117,7 +119,7 @@ Hammer::~Hammer() { }
Hammer::Hammer(
RCThread::Scope scope, RCLock* lock, RCCondition *cond, PRUint32 clip):
- HammerData(lock, cond, clip), RCThread(scope, RCThread::joinable, 0) { }
+ HammerData(lock, cond, clip), RCThread(scope, RCThread::joinable, 0) { }
HammerData::~HammerData() { }
@@ -171,7 +173,9 @@ void Hammer::RootFunction()
(void)sprintf(filename, "%ssg%04p.dat", baseName, this);
- if (debug_mode) PR_fprintf(output, "Starting work on %s\n", filename);
+ if (debug_mode) {
+ PR_fprintf(output, "Starting work on %s\n", filename);
+ }
while (PR_TRUE)
{
@@ -182,52 +186,78 @@ void Hammer::RootFunction()
while (minor-- > 0)
{
problem = sg_okay;
- if (action != sg_go) goto finished;
+ if (action != sg_go) {
+ goto finished;
+ }
problem = sg_open;
rv = file.Open(filename, PR_RDWR|PR_CREATE_FILE, 0666);
- if (PR_FAILURE == rv) goto finished;
+ if (PR_FAILURE == rv) {
+ goto finished;
+ }
for (index = 0; index < pages; index++)
{
problem = sg_okay;
- if (action != sg_go) goto close;
+ if (action != sg_go) {
+ goto close;
+ }
problem = sg_seek;
bytes = file.Seek(pageSize * index, RCFileIO::set);
- if (bytes != pageSize * index) goto close;
+ if (bytes != pageSize * index) {
+ goto close;
+ }
problem = sg_write;
bytes = file.Write(&zero, sizeof(zero));
- if (bytes <= 0) goto close;
+ if (bytes <= 0) {
+ goto close;
+ }
writes += 1;
}
problem = sg_close;
rv = file.Close();
- if (rv != PR_SUCCESS) goto purge;
+ if (rv != PR_SUCCESS) {
+ goto purge;
+ }
problem = sg_okay;
- if (action != sg_go) goto purge;
+ if (action != sg_go) {
+ goto purge;
+ }
problem = sg_open;
rv = file.Open(filename, PR_RDWR, 0666);
- if (PR_FAILURE == rv) goto finished;
+ if (PR_FAILURE == rv) {
+ goto finished;
+ }
for (index = 0; index < pages; index++)
{
problem = sg_okay;
- if (action != sg_go) goto close;
+ if (action != sg_go) {
+ goto close;
+ }
problem = sg_seek;
bytes = file.Seek(pageSize * index, RCFileIO::set);
- if (bytes != pageSize * index) goto close;
+ if (bytes != pageSize * index) {
+ goto close;
+ }
problem = sg_write;
bytes = file.Write(&zero, sizeof(zero));
- if (bytes <= 0) goto close;
+ if (bytes <= 0) {
+ goto close;
+ }
writes += 1;
random = (random + 511) % pages;
}
problem = sg_close;
rv = file.Close();
- if (rv != PR_SUCCESS) goto purge;
+ if (rv != PR_SUCCESS) {
+ goto purge;
+ }
problem = sg_delete;
rv = file.Delete(filename);
- if (rv != PR_SUCCESS) goto finished;
- }
+ if (rv != PR_SUCCESS) {
+ goto finished;
+ }
+ }
}
close:
@@ -239,7 +269,9 @@ finished:
action = HammerData::sg_done;
cv->Notify();
- if (debug_mode) PR_fprintf(output, "Ending work on %s\n", filename);
+ if (debug_mode) {
+ PR_fprintf(output, "Ending work on %s\n", filename);
+ }
return;
} /* Hammer::RootFunction */
@@ -278,7 +310,7 @@ static Hammer* hammer[100];
PRIntn main (PRIntn argc, char *argv[])
{
RCLock ml;
- PLOptStatus os;
+ PLOptStatus os;
RCCondition cv(&ml);
PRUint32 writesMax = 0, durationTot = 0;
RCThread::Scope thread_scope = RCThread::local;
@@ -288,57 +320,65 @@ PRIntn main (PRIntn argc, char *argv[])
const char *where[] = {"okay", "open", "close", "delete", "write", "seek"};
- PLOptState *opt = PL_CreateOptState(argc, argv, "Gdl:t:i:");
- while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
+ PLOptState *opt = PL_CreateOptState(argc, argv, "Gdl:t:i:");
+ while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
- if (PL_OPT_BAD == os) continue;
+ if (PL_OPT_BAD == os) {
+ continue;
+ }
switch (opt->option)
{
- case 0:
- baseName = opt->value;
- break;
- case 'G': /* global threads */
- thread_scope = RCThread::global;
- break;
- case 'd': /* debug mode */
- debug_mode = 1;
- break;
- case 'l': /* limiting number */
- limit = atoi(opt->value);
- break;
- case 't': /* number of threads */
- threads = atoi(opt->value);
- break;
- case 'i': /* iteration counter */
- max_virtual_procs = atoi(opt->value);
- break;
- default:
- break;
+ case 0:
+ baseName = opt->value;
+ break;
+ case 'G': /* global threads */
+ thread_scope = RCThread::global;
+ break;
+ case 'd': /* debug mode */
+ debug_mode = 1;
+ break;
+ case 'l': /* limiting number */
+ limit = atoi(opt->value);
+ break;
+ case 't': /* number of threads */
+ threads = atoi(opt->value);
+ break;
+ case 'i': /* iteration counter */
+ max_virtual_procs = atoi(opt->value);
+ break;
+ default:
+ break;
}
}
- PL_DestroyOptState(opt);
+ PL_DestroyOptState(opt);
output = PR_GetSpecialFD(PR_StandardOutput);
- /* main test */
-
+ /* main test */
+
cv.SetTimeout(interleave);
-
- if (max_virtual_procs == 0) max_virtual_procs = 2;
- if (limit == 0) limit = 57;
- if (threads == 0) threads = 10;
+
+ if (max_virtual_procs == 0) {
+ max_virtual_procs = 2;
+ }
+ if (limit == 0) {
+ limit = 57;
+ }
+ if (threads == 0) {
+ threads = 10;
+ }
if (debug_mode) PR_fprintf(output,
- "%s: Using %d virtual processors, %d threads, limit = %d and %s threads\n",
- programName, max_virtual_procs, threads, limit,
- (thread_scope == RCThread::local) ? "LOCAL" : "GLOBAL");
+ "%s: Using %d virtual processors, %d threads, limit = %d and %s threads\n",
+ programName, max_virtual_procs, threads, limit,
+ (thread_scope == RCThread::local) ? "LOCAL" : "GLOBAL");
for (virtual_procs = 0; virtual_procs < max_virtual_procs; ++virtual_procs)
{
if (debug_mode)
- PR_fprintf(output,
- "%s: Setting number of virtual processors to %d\n",
- programName, virtual_procs + 1);
- RCPrimordialThread::SetVirtualProcessors(virtual_procs + 1);
+ PR_fprintf(output,
+ "%s: Setting number of virtual processors to %d\n",
+ programName, virtual_procs + 1);
+ RCPrimordialThread::SetVirtualProcessors(virtual_procs + 1);
for (active = 0; active < threads; active++)
{
hammer[active] = new Hammer(thread_scope, &ml, &cv, limit);
@@ -354,8 +394,9 @@ PRIntn main (PRIntn argc, char *argv[])
RCEnter scope(&ml);
for (poll = 0; poll < threads; poll++)
{
- if (hammer[poll]->action == HammerData::sg_go) /* don't overwrite done */
- hammer[poll]->action = HammerData::sg_stop; /* ask him to stop */
+ if (hammer[poll]->action == HammerData::sg_go) { /* don't overwrite done */
+ hammer[poll]->action = HammerData::sg_stop; /* ask him to stop */
+ }
}
}
@@ -364,24 +405,32 @@ PRIntn main (PRIntn argc, char *argv[])
for (poll = 0; poll < threads; poll++)
{
ml.Acquire();
- while (hammer[poll]->action < HammerData::sg_done) cv.Wait();
+ while (hammer[poll]->action < HammerData::sg_done) {
+ cv.Wait();
+ }
ml.Release();
if (hammer[poll]->problem == HammerData::sg_okay)
{
duration = RCInterval(RCInterval::now) - hammer[poll]->timein;
writes = hammer[poll]->writes * 1000 / duration;
- if (writes < writesMin) writesMin = writes;
- if (writes > writesMax) writesMax = writes;
+ if (writes < writesMin) {
+ writesMin = writes;
+ }
+ if (writes > writesMax) {
+ writesMax = writes;
+ }
writesTot += hammer[poll]->writes;
durationTot += duration;
}
else
{
if (debug_mode) PR_fprintf(output,
- "%s: test failed %s after %ld seconds\n",
- programName, where[hammer[poll]->problem], duration);
- else failed_already=1;
+ "%s: test failed %s after %ld seconds\n",
+ programName, where[hammer[poll]->problem], duration);
+ else {
+ failed_already=1;
+ }
}
active -= 1; /* this is another one down */
(void)hammer[poll]->Join();
@@ -389,12 +438,12 @@ PRIntn main (PRIntn argc, char *argv[])
}
}
if (debug_mode) PR_fprintf(output,
- "%s: [%ld [%ld] %ld] writes/sec average\n",
- programName, writesMin,
- writesTot * 1000 / durationTot, writesMax);
+ "%s: [%ld [%ld] %ld] writes/sec average\n",
+ programName, writesMin,
+ writesTot * 1000 / durationTot, writesMax);
}
- failed_already |= (PR_FAILURE == RCPrimordialThread::Cleanup());
- PR_fprintf(output, "%s\n", (failed_already) ? "FAIL\n" : "PASS\n");
- return failed_already;
+ failed_already |= (PR_FAILURE == RCPrimordialThread::Cleanup());
+ PR_fprintf(output, "%s\n", (failed_already) ? "FAIL\n" : "PASS\n");
+ return failed_already;
} /* main */
diff --git a/nsprpub/pr/src/cplus/tests/switch.cpp b/nsprpub/pr/src/cplus/tests/switch.cpp
index 4cb14c48f..00de8e306 100644
--- a/nsprpub/pr/src/cplus/tests/switch.cpp
+++ b/nsprpub/pr/src/cplus/tests/switch.cpp
@@ -70,8 +70,12 @@ void Shared::RootFunction()
while (PR_SUCCESS == status)
{
RCEnter entry(ml);
- while (twiddle && (PR_SUCCESS == status)) status = Wait();
- if (verbosity) PR_fprintf(debug_out, "+");
+ while (twiddle && (PR_SUCCESS == status)) {
+ status = Wait();
+ }
+ if (verbosity) {
+ PR_fprintf(debug_out, "+");
+ }
twiddle = PR_TRUE;
next->twiddle = PR_FALSE;
next->Notify();
@@ -83,11 +87,11 @@ static void Help(void)
debug_out = PR_STDOUT;
PR_fprintf(
- debug_out, "Usage: >./switch [-d] [-c n] [-t n] [-T n] [-G]\n");
+ debug_out, "Usage: >./switch [-d] [-c n] [-t n] [-T n] [-G]\n");
PR_fprintf(
- debug_out, "-c n\tloops at thread level (default: %d)\n", DEFAULT_LOOPS);
+ debug_out, "-c n\tloops at thread level (default: %d)\n", DEFAULT_LOOPS);
PR_fprintf(
- debug_out, "-t n\tnumber of threads (default: %d)\n", DEFAULT_THREADS);
+ debug_out, "-t n\tnumber of threads (default: %d)\n", DEFAULT_THREADS);
PR_fprintf(debug_out, "-d\tturn on debugging output (default: FALSE)\n");
PR_fprintf(debug_out, "-v\tturn on verbose output (default: FALSE)\n");
PR_fprintf(debug_out, "-G n\tglobal threads only (default: FALSE)\n");
@@ -96,59 +100,63 @@ static void Help(void)
PRIntn main(PRIntn argc, char **argv)
{
- PLOptStatus os;
+ PLOptStatus os;
PRStatus status;
PRBool help = PR_FALSE;
PRUintn concurrency = 1;
RCThread::Scope thread_scope = RCThread::local;
PRUintn thread_count, inner_count, loop_count, average;
PRUintn thread_limit = DEFAULT_THREADS, loop_limit = DEFAULT_LOOPS;
- PLOptState *opt = PL_CreateOptState(argc, argv, "hdvc:t:C:G");
- while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
+ PLOptState *opt = PL_CreateOptState(argc, argv, "hdvc:t:C:G");
+ while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
- if (PL_OPT_BAD == os) continue;
+ if (PL_OPT_BAD == os) {
+ continue;
+ }
switch (opt->option)
{
- case 'v': /* verbose mode */
- verbosity = PR_TRUE;
- case 'd': /* debug mode */
- debug_mode = PR_TRUE;
- break;
- case 'c': /* loop counter */
- loop_limit = atoi(opt->value);
- break;
- case 't': /* thread limit */
- thread_limit = atoi(opt->value);
- break;
- case 'C': /* Concurrency limit */
- concurrency = atoi(opt->value);
- break;
- case 'G': /* global threads only */
- thread_scope = RCThread::global;
- break;
- case 'h': /* help message */
- Help();
- help = PR_TRUE;
- break;
- default:
- break;
+ case 'v': /* verbose mode */
+ verbosity = PR_TRUE;
+ case 'd': /* debug mode */
+ debug_mode = PR_TRUE;
+ break;
+ case 'c': /* loop counter */
+ loop_limit = atoi(opt->value);
+ break;
+ case 't': /* thread limit */
+ thread_limit = atoi(opt->value);
+ break;
+ case 'C': /* Concurrency limit */
+ concurrency = atoi(opt->value);
+ break;
+ case 'G': /* global threads only */
+ thread_scope = RCThread::global;
+ break;
+ case 'h': /* help message */
+ Help();
+ help = PR_TRUE;
+ break;
+ default:
+ break;
}
}
- PL_DestroyOptState(opt);
-
- if (help) return -1;
-
- if (PR_TRUE == debug_mode)
- {
- debug_out = PR_STDOUT;
- PR_fprintf(debug_out, "Test parameters\n");
- PR_fprintf(debug_out, "\tThreads involved: %d\n", thread_limit);
- PR_fprintf(debug_out, "\tIteration limit: %d\n", loop_limit);
- PR_fprintf(debug_out, "\tConcurrency: %d\n", concurrency);
- PR_fprintf(
- debug_out, "\tThread type: %s\n",
- (PR_GLOBAL_THREAD == thread_scope) ? "GLOBAL" : "LOCAL");
- }
+ PL_DestroyOptState(opt);
+
+ if (help) {
+ return -1;
+ }
+
+ if (PR_TRUE == debug_mode)
+ {
+ debug_out = PR_STDOUT;
+ PR_fprintf(debug_out, "Test parameters\n");
+ PR_fprintf(debug_out, "\tThreads involved: %d\n", thread_limit);
+ PR_fprintf(debug_out, "\tIteration limit: %d\n", loop_limit);
+ PR_fprintf(debug_out, "\tConcurrency: %d\n", concurrency);
+ PR_fprintf(
+ debug_out, "\tThread type: %s\n",
+ (PR_GLOBAL_THREAD == thread_scope) ? "GLOBAL" : "LOCAL");
+ }
/*
** The interesting part starts here
@@ -165,62 +173,68 @@ PRIntn main(PRIntn argc, char **argv)
shared = new Shared(thread_scope, link, &lock);
shared->Start(); /* make it run */
link = (Home*)shared;
- }
+ }
/* Pass the message around the horn a few times */
for (loop_count = 1; loop_count <= loop_limit; ++loop_count)
{
- timein.SetToNow();
- for (inner_count = 0; inner_count < INNER_LOOPS; ++inner_count)
- {
- RCEnter entry(&lock);
- home.twiddle = PR_TRUE;
- shared->twiddle = PR_FALSE;
- shared->Notify();
- while (home.twiddle)
+ timein.SetToNow();
+ for (inner_count = 0; inner_count < INNER_LOOPS; ++inner_count)
+ {
+ RCEnter entry(&lock);
+ home.twiddle = PR_TRUE;
+ shared->twiddle = PR_FALSE;
+ shared->Notify();
+ while (home.twiddle)
{
- failed = (PR_FAILURE == home.Wait()) ? PR_TRUE : PR_FALSE;
+ failed = (PR_FAILURE == home.Wait()) ? PR_TRUE : PR_FALSE;
}
- }
- timeout += (RCInterval(RCInterval::now) - timein);
- }
+ }
+ timeout += (RCInterval(RCInterval::now) - timein);
+ }
/* Figure out how well we did */
- if (debug_mode)
- {
- average = timeout.ToMicroseconds()
- / (INNER_LOOPS * loop_limit * thread_count);
- PR_fprintf(
- debug_out, "Average switch times %d usecs for %d threads\n",
+ if (debug_mode)
+ {
+ average = timeout.ToMicroseconds()
+ / (INNER_LOOPS * loop_limit * thread_count);
+ PR_fprintf(
+ debug_out, "Average switch times %d usecs for %d threads\n",
average, thread_limit);
- }
+ }
/* Start reclamation process */
link = shared;
for (thread_count = 1; thread_count <= thread_limit; ++thread_count)
{
- if (&home == link) break;
+ if (&home == link) {
+ break;
+ }
status = ((Shared*)link)->Interrupt();
- if (PR_SUCCESS != status)
+ if (PR_SUCCESS != status)
{
failed = PR_TRUE;
- if (debug_mode)
- PL_FPrintError(debug_out, "Failed to interrupt");
+ if (debug_mode) {
+ PL_FPrintError(debug_out, "Failed to interrupt");
+ }
}
- link = link->next;
+ link = link->next;
}
for (thread_count = 1; thread_count <= thread_limit; ++thread_count)
{
link = shared->next;
status = shared->Join();
- if (PR_SUCCESS != status)
- {
+ if (PR_SUCCESS != status)
+ {
failed = PR_TRUE;
- if (debug_mode)
- PL_FPrintError(debug_out, "Failed to join");
+ if (debug_mode) {
+ PL_FPrintError(debug_out, "Failed to join");
+ }
+ }
+ if (&home == link) {
+ break;
}
- if (&home == link) break;
shared = (Shared*)link;
}
diff --git a/nsprpub/pr/src/cplus/tests/thread.cpp b/nsprpub/pr/src/cplus/tests/thread.cpp
index 442c534d0..ff01402d8 100644
--- a/nsprpub/pr/src/cplus/tests/thread.cpp
+++ b/nsprpub/pr/src/cplus/tests/thread.cpp
@@ -28,7 +28,9 @@ private:
TestThread::~TestThread() { }
TestThread::TestThread(RCThread::State state, PRIntn count):
- RCThread(RCThread::global, state, 0) { mydata = count; }
+ RCThread(RCThread::global, state, 0) {
+ mydata = count;
+}
void TestThread::RootFunction()
{
@@ -46,7 +48,7 @@ public:
PRIntn data;
};
-Foo1::Foo1()
+Foo1::Foo1()
{
data = 0xafaf;
thread = new TestThread(RCThread::joinable, 0xafaf);
diff --git a/nsprpub/pr/src/cplus/tests/tpd.cpp b/nsprpub/pr/src/cplus/tests/tpd.cpp
index 42290ab11..2a18c9cb1 100644
--- a/nsprpub/pr/src/cplus/tests/tpd.cpp
+++ b/nsprpub/pr/src/cplus/tests/tpd.cpp
@@ -68,8 +68,9 @@ static void PrintProgress(PRIntn line)
static void MyAssert(const char *expr, const char *file, PRIntn line)
{
- if (debug > 0)
+ if (debug > 0) {
(void)PR_fprintf(fout, "'%s' in file: %s: %d\n", expr, file, line);
+ }
} /* MyAssert */
#define MY_ASSERT(_expr) \
@@ -86,14 +87,16 @@ int main(PRIntn argc, char *argv[])
RCThread *primordial = RCThread::WrapPrimordialThread();
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
- if (PL_OPT_BAD == os) continue;
+ if (PL_OPT_BAD == os) {
+ continue;
+ }
switch (opt->option)
{
- case 'd': /* debug mode */
- debug = PR_TRUE;
- break;
- default:
- break;
+ case 'd': /* debug mode */
+ debug = PR_TRUE;
+ break;
+ default:
+ break;
}
}
PL_DestroyOptState(opt);
@@ -103,8 +106,9 @@ int main(PRIntn argc, char *argv[])
MyPrivateData extension = MyPrivateData("EXTENSION");
MyPrivateData key_string[] = {
"Key #0", "Key #1", "Key #2", "Key #3",
- "Bogus #5", "Bogus #6", "Bogus #7", "Bogus #8"};
-
+ "Bogus #5", "Bogus #6", "Bogus #7", "Bogus #8"
+ };
+
did = should = PR_FALSE;
for (keys = 0; keys < 4; ++keys)
@@ -133,7 +137,7 @@ int main(PRIntn argc, char *argv[])
}
PrintProgress(__LINE__);
- /* re-assign the private data, albeit the same content */
+ /* re-assign the private data, albeit the same content */
did = PR_FALSE; should = PR_TRUE;
for (keys = 0; keys < 4; ++keys)
{
@@ -190,13 +194,21 @@ int main(PRIntn argc, char *argv[])
MY_ASSERT(PR_SUCCESS == rv);
}
- if (debug) PR_fprintf(fout, "Creating thread\n");
+ if (debug) {
+ PR_fprintf(fout, "Creating thread\n");
+ }
thread = new MyThread();
- if (debug) PR_fprintf(fout, "Starting thread\n");
+ if (debug) {
+ PR_fprintf(fout, "Starting thread\n");
+ }
thread->Start();
- if (debug) PR_fprintf(fout, "Joining thread\n");
+ if (debug) {
+ PR_fprintf(fout, "Joining thread\n");
+ }
(void)thread->Join();
- if (debug) PR_fprintf(fout, "Joined thread\n");
+ if (debug) {
+ PR_fprintf(fout, "Joined thread\n");
+ }
failed |= (PR_FAILURE == RCPrimordialThread::Cleanup());
@@ -237,8 +249,12 @@ MyPrivateData::MyPrivateData(const MyPrivateData& him): RCThreadPrivateData(him)
void MyPrivateData::Release()
{
- if (should) did = PR_TRUE;
- else failed = PR_TRUE;
+ if (should) {
+ did = PR_TRUE;
+ }
+ else {
+ failed = PR_TRUE;
+ }
} /* MyPrivateData::operator= */
/*
@@ -253,12 +269,13 @@ void MyThread::RootFunction()
PRStatus rv;
PRUintn keys;
const RCThreadPrivateData *pd;
-
+
MyPrivateData extension = MyPrivateData("EXTENSION");
MyPrivateData key_string[] = {
"Key #0", "Key #1", "Key #2", "Key #3",
- "Bogus #5", "Bogus #6", "Bogus #7", "Bogus #8"};
-
+ "Bogus #5", "Bogus #6", "Bogus #7", "Bogus #8"
+ };
+
did = should = PR_FALSE;
for (keys = 0; keys < 8; ++keys)
{
@@ -284,7 +301,7 @@ void MyThread::RootFunction()
}
PrintProgress(__LINE__);
#endif
-
+
did = PR_FALSE; should = PR_TRUE;
for (keys = 0; keys < 4; ++keys)
{