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

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

[Dotgnu-pnet-commits] CVS: pnet/engine engine.h,1.78,1.79 ilrun.c,1.34,


From: Thong Nguyen <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine engine.h,1.78,1.79 ilrun.c,1.34,1.35 lib_thread.c,1.14,1.15 process.c,1.48,1.49 thread.c,1.17,1.18
Date: Sat, 05 Jul 2003 18:51:35 -0400

Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv12446/engine

Modified Files:
        engine.h ilrun.c lib_thread.c process.c thread.c 
Log Message:
Threading improvements.  Better background thread management.


Index: engine.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/engine.h,v
retrieving revision 1.78
retrieving revision 1.79
diff -C2 -r1.78 -r1.79
*** engine.h    5 Jul 2003 12:20:09 -0000       1.78
--- engine.h    5 Jul 2003 22:51:32 -0000       1.79
***************
*** 131,139 ****
  #endif
  
-       int userThreadCount;
- 
-       /* WaitEvent that gets set when the last non-main thread is destroyed */
-       ILWaitHandle *noMoreUserThreads;
- 
        /* Hash table that maps program items to reflection objects */
        void               *reflectionHash;
--- 131,134 ----
***************
*** 233,240 ****
        ILUInt32                maxFrames;
  
-       /* 1 if the thread is a user (non runtime) thread.  User threads keep 
the
-               process from exiting until they finish */
-       ILUInt32                isUserThread;
- 
        /* Thread-static values for this thread */
        void              **threadStaticSlots;
--- 228,231 ----
***************
*** 366,370 ****
   * responsible for creating the OS-level thread.
   */
! ILExecThread *_ILExecThreadCreate(ILExecProcess *process, int userThread);
  
  /*
--- 357,361 ----
   * responsible for creating the OS-level thread.
   */
! ILExecThread *_ILExecThreadCreate(ILExecProcess *process);
  
  /*

Index: ilrun.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/ilrun.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** ilrun.c     26 Jun 2003 03:39:25 -0000      1.34
--- ilrun.c     5 Jul 2003 22:51:32 -0000       1.35
***************
*** 23,26 ****
--- 23,27 ----
  #include "il_image.h"
  #include "il_utils.h"
+ #include "il_thread.h"
  #if defined(HAVE_UNISTD_H) && !defined(_MSC_VER)
  #include <unistd.h>
***************
*** 433,438 ****
        }
  
!       /* Wait for all other threads to finish */
!       ILExecProcessWaitForUserThreads(process);
  
  #if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
--- 434,439 ----
        }
  
!       /* Wait for all other foreground threads to finish */
!       ILThreadWaitForForegroundThreads(-1);
  
  #if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
***************
*** 480,483 ****
--- 481,485 ----
        error = ILExecProcessGetStatus(process);
        ILExecProcessDestroy(process);
+ 
        return (int)retval;
  }

Index: lib_thread.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_thread.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** lib_thread.c        5 Jul 2003 08:30:56 -0000       1.14
--- lib_thread.c        5 Jul 2003 22:51:32 -0000       1.15
***************
*** 1059,1063 ****
        /* Register the support thread for managed code execution */
  
!       if ((execThread = ILThreadRegisterForManagedExecution(thread->process, 
supportThread, 1)) == 0)
        {
                /* Runtime isn't fully initialized.  This should never happen */
--- 1059,1063 ----
        /* Register the support thread for managed code execution */
  
!       if ((execThread = ILThreadRegisterForManagedExecution(thread->process, 
supportThread)) == 0)
        {
                /* Runtime isn't fully initialized.  This should never happen */

Index: process.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/process.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -r1.48 -r1.49
*** process.c   2 Jul 2003 23:43:57 -0000       1.48
--- process.c   5 Jul 2003 22:51:32 -0000       1.49
***************
*** 36,45 ****
  }
  
- void ILExecProcessWaitForUserThreads(ILExecProcess *process)
- {
-       /* Wait for all user threads to finish */
-       ILWaitOne(process->noMoreUserThreads, -1);
- }
- 
  ILExecProcess *ILExecProcessCreate(unsigned long stackSize, unsigned long 
cachePageSize)
  {
--- 36,39 ----
***************
*** 56,60 ****
        process->firstThread = 0;
        process->mainThread = 0;
-       process->userThreadCount = 0;           
  #ifdef USE_HASHING_MONITORS
        process->monitorHash = 0;
--- 50,53 ----
***************
*** 91,102 ****
        process->numThreadStaticSlots = 0;
  
-       /* Create a new event that indicates when there are more no user 
threads */
-       /* The event is initially set */
-       if ((process->noMoreUserThreads = ILWaitEventCreate(1, 1)) == 0)
-       {
-               ILExecProcessDestroy(process);
-               return 0;
-       }
- 
        /* Initialize the image loading context */
        if((process->context = ILContextCreate()) == 0)
--- 84,87 ----
***************
*** 141,145 ****
  
        /* Register the main thread for managed execution */
!       process->mainThread = ILThreadRegisterForManagedExecution(process, 
ILThreadSelf(), 0);
        
        if(!(process->mainThread))
--- 126,130 ----
  
        /* Register the main thread for managed execution */
!       process->mainThread = ILThreadRegisterForManagedExecution(process, 
ILThreadSelf());
        
        if(!(process->mainThread))
***************
*** 178,184 ****
        ILCoderDestroy(process->coder);
  
-       /* Destroy the NoMoreUserThreads wait event */
-       ILWaitHandleClose(process->noMoreUserThreads);
- 
        /* Destroy the metadata lock */
        if(process->metadataLock)
--- 163,166 ----
***************
*** 257,260 ****
--- 239,245 ----
        /* Free the process block itself */
        ILGCFreePersistent(process);
+ 
+       /* Cleanup the threading subsystem */
+       ILThreadDeinit();
  }
  

Index: thread.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/thread.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** thread.c    5 Jul 2003 08:30:56 -0000       1.17
--- thread.c    5 Jul 2003 22:51:32 -0000       1.18
***************
*** 72,81 ****
   *    Registers a thread for managed execution
   */
! ILExecThread *ILThreadRegisterForManagedExecution(ILExecProcess *process, 
ILThread *thread, int isUserThread)
  {     
        ILExecThread *execThread;
  
        /* Create a new engine-level thread */  
!       execThread = _ILExecThreadCreate(process, isUserThread);
  
        /* Associate the new engine-level thread with the OS-level thread */
--- 72,81 ----
   *    Registers a thread for managed execution
   */
! ILExecThread *ILThreadRegisterForManagedExecution(ILExecProcess *process, 
ILThread *thread)
  {     
        ILExecThread *execThread;
  
        /* Create a new engine-level thread */  
!       execThread = _ILExecThreadCreate(process);
  
        /* Associate the new engine-level thread with the OS-level thread */
***************
*** 88,92 ****
  }
  
! ILExecThread *_ILExecThreadCreate(ILExecProcess *process, int isUserThread)
  {
        ILExecThread *thread;
--- 88,92 ----
  }
  
! ILExecThread *_ILExecThreadCreate(ILExecProcess *process)
  {
        ILExecThread *thread;
***************
*** 123,128 ****
        thread->supportThread = 0;
        thread->clrThread = 0;  
!       thread->freeMonitor = 0;
!       thread->isUserThread = isUserThread;
        thread->pc = 0;
        thread->frame = thread->stackBase;
--- 123,127 ----
        thread->supportThread = 0;
        thread->clrThread = 0;  
!       thread->freeMonitor = 0;        
        thread->pc = 0;
        thread->frame = thread->stackBase;
***************
*** 145,159 ****
        process->firstThread = thread;
  
-       if (isUserThread)
-       {
-               process->userThreadCount++;
-       }
- 
-       if (process->userThreadCount > 0)
-       {
-               /* Prevent the process from exiting */
-               ILWaitEventReset(process->noMoreUserThreads);
-       }
- 
        ILMutexUnlock(process->lock);
        
--- 144,147 ----
***************
*** 174,189 ****
        {
                process->mainThread = 0;
-       }
- 
-       /* Decrement the use thread count */
-       if (thread->isUserThread)
-       {
-               process->userThreadCount--;     
-       }
- 
-       /* Let the main process exit */
-       if (process->userThreadCount == 0)
-       {
-               ILWaitEventSet(process->noMoreUserThreads);
        }
  
--- 162,165 ----





reply via email to

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