Minor bug fix: instead of relying on the initialization
authorOrion Lawlor <olawlor@acm.org>
Mon, 25 Aug 2003 23:33:26 +0000 (23:33 +0000)
committerOrion Lawlor <olawlor@acm.org>
Mon, 25 Aug 2003 23:33:26 +0000 (23:33 +0000)
order of global variables to set the initial stack size,
check for a zero stack size explicitly.

Without this fix, all tcharm threads were created with
the default (32K!) stack size...

src/libs/ck-libs/tcharm/tcharm.C
src/libs/ck-libs/tcharm/tcharm_impl.h

index d836d936bea9b2b0277d9e1ad1809aa9cbd57288..d1b61c8f6549bf987e0aca9ca7448360866a77ce 100644 (file)
@@ -111,6 +111,7 @@ static void startTCharmThread(TCharmInitMsg *msg)
 TCharm::TCharm(TCharmInitMsg *initMsg_)
 {
   initMsg=initMsg_;
+  initMsg->opts.sanityCheck();
   timeOffset=0.0;
   if (tcharm_nothreads)
   { //Don't even make a new thread-- just use main thread
@@ -429,9 +430,13 @@ FDECL int FTN_NAME(TCHARM_GET_NUM_CHUNKS,tcharm_get_num_chunks)(void)
 // Fill out the default thread options:
 TCHARM_Thread_options::TCHARM_Thread_options(int doDefault)
 {
-       stackSize=tcharm_stacksize; /* default stacksize */
+       stackSize=0; /* default stacksize */
        exitWhenDone=0; /* don't exit when done by default. */
 }
+void TCHARM_Thread_options::sanityCheck(void) {
+       if (stackSize<=0) stackSize=tcharm_stacksize;
+}
+
 
 TCHARM_Thread_options g_tcharmOptions(1);
 
index 3ee39bdcf98a1cb7777c2035fca0978b9c5ee6ea..70353674c9ed762caf604c8baea86cd3269c0cf8 100644 (file)
@@ -33,6 +33,8 @@ public:
        // Fill out the default thread options:
        TCHARM_Thread_options(int doDefault);
        TCHARM_Thread_options() {}
+
+       void sanityCheck(void);
 };
 
 class TCharmInitMsg : public CMessage_TCharmInitMsg {