dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/support thread.c,1.6,1.7


From: Thong Nguyen <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/support thread.c,1.6,1.7
Date: Sat, 05 Jul 2003 04:24:51 -0400

Update of /cvsroot/dotgnu-pnet/pnet/support
In directory subversions:/tmp/cvs-serv718

Modified Files:
        thread.c 
Log Message:
Changed so system threads aren't created until the thread is started.


Index: thread.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/thread.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** thread.c    21 Jun 2003 05:41:23 -0000      1.6
--- thread.c    5 Jul 2003 08:24:49 -0000       1.7
***************
*** 39,43 ****
  static long volatile numThreads;
  static long volatile numBackgroundThreads;
- static _ILSemaphore startupAck;
  
  /*
--- 39,42 ----
***************
*** 65,70 ****
  
        /* Initialize synchronization objects that we need */
!       _ILMutexCreate(&threadLockAll);
!       _ILSemaphoreCreate(&startupAck);
        _ILMutexCreate(&atomicLock);
  
--- 64,68 ----
  
        /* Initialize synchronization objects that we need */
!       _ILMutexCreate(&threadLockAll); 
        _ILMutexCreate(&atomicLock);
  
***************
*** 100,109 ****
        int isbg;
  
-       /* Signal "ILThreadCreate" that the thread is ready to go */
-       _ILSemaphorePost(&startupAck);
- 
-       /* Wait until the thread is really started by a call to "ILThreadStart" 
*/
-       _ILThreadSuspendSelf(thread);
- 
        /* If we still have a startup function, then execute it.
           The field may have been replaced with NULL if the thread
--- 98,101 ----
***************
*** 158,182 ****
        _ILWakeupCreate(&(thread->wakeup));
        _ILWakeupQueueCreate(&(thread->joinQueue));
  
        /* Lock out the thread system */
        _ILMutexLock(&threadLockAll);
  
-       /* Create the new thread */
-       if(!_ILThreadCreateSystem(thread))
-       {
-               _ILMutexUnlock(&threadLockAll);
-               _ILWakeupQueueDestroy(&(thread->joinQueue));
-               _ILWakeupDestroy(&(thread->wakeup));
-               _ILSemaphoreDestroy(&(thread->suspendAck));
-               _ILSemaphoreDestroy(&(thread->resumeAck));
-               _ILMutexDestroy(&(thread->lock));
-               ILFree(thread);
-               return 0;
-       }
- 
-       /* Wait until the thread startup ack is posted, so that
-          we know that the thread is ready to go */
-       _ILSemaphoreWait(&startupAck);
- 
        /* We have one extra thread in the system at present */
        ++numThreads;
--- 150,158 ----
        _ILWakeupCreate(&(thread->wakeup));
        _ILWakeupQueueCreate(&(thread->joinQueue));
+       thread->handle = 0;
  
        /* Lock out the thread system */
        _ILMutexLock(&threadLockAll);
  
        /* We have one extra thread in the system at present */
        ++numThreads;
***************
*** 197,204 ****
        if((thread->state & IL_TS_UNSTARTED) != 0)
        {
!               /* Resume the thread, which is suspended in "ThreadStart" */
!               thread->state &= ~IL_TS_UNSTARTED;
!               _ILThreadResumeSelf(thread);
!               result = 1;
        }
        else
--- 173,187 ----
        if((thread->state & IL_TS_UNSTARTED) != 0)
        {
!               /* Create the new thread */
!               if(!_ILThreadCreateSystem(thread))
!               {
!                       result = 0;
!               }
!               else
!               {
!                       /* Set the thread state to running (0) */
!                       thread->state &= ~IL_TS_UNSTARTED;
!                       result = 1;
!               }
        }
        else
***************
*** 434,438 ****
                        result = 0;
                }
!               else if((thread->state & IL_TS_ABORT_REQUESTED) != 0)
                {
                        /* Abort was requested */
--- 417,421 ----
                        result = 0;
                }
!                       else if((thread->state & IL_TS_ABORT_REQUESTED) != 0)
                {
                        /* Abort was requested */
***************
*** 462,465 ****
--- 445,449 ----
                        _ILMutexUnlock(&(thread->lock));
                        _ILWakeupInterrupt(&(thread->wakeup));
+ 
                        return 0;
                }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]