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 hb_gc.c, 1.19, 1.20 no_defs.c, 1


From: Thong Nguyen <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/support hb_gc.c, 1.19, 1.20 no_defs.c, 1.2, 1.3 pt_defs.c, 1.6, 1.7 thr_defs.h, 1.7, 1.8 thread.c, 1.13, 1.14 w32_defs.c, 1.2, 1.3 wait.c, 1.4, 1.5 wait_event.c, 1.1, 1.2 wait_mutex.c, 1.5, 1.6 wakeup.c, 1.6, 1.7
Date: Tue, 15 Jul 2003 18:17:35 -0400

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

Modified Files:
        hb_gc.c no_defs.c pt_defs.c thr_defs.h thread.c w32_defs.c 
        wait.c wait_event.c wait_mutex.c wakeup.c 
Log Message:
Various updates to threading & finalization


Index: hb_gc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/hb_gc.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** hb_gc.c     8 Jul 2003 12:05:17 -0000       1.19
--- hb_gc.c     15 Jul 2003 22:17:33 -0000      1.20
***************
*** 34,43 ****
  #endif
  
! /* #define GC_TRACE_ENABLE */
  
  /*
   * Set to non-zero if finalization has been temporarily disabled.
   */
! static int volatile FinalizersDisabled = 0;
  
  /*
--- 34,43 ----
  #endif
  
! /*#define GC_TRACE_ENABLE*/
  
  /*
   * Set to non-zero if finalization has been temporarily disabled.
   */
! static int volatile _FinalizersDisabled = 0;
  
  /*
***************
*** 53,56 ****
--- 53,61 ----
  
  /*
+  *    Flag that is 1 if finalizers are running.
+  */
+ static volatile int _FinalizersRunning = 0;
+ 
+ /*
   *    The finalizer thread.
   */
***************
*** 94,105 ****
                GC_TRACE("GC:_FinalizerThread: Signal [thread:%d]\n", 
(int)ILThreadSelf());
  
!               if (GC_should_invoke_finalizers())
                {
                        GC_TRACE("GC:_FinalizerThread: Finalizers running 
[thread:%d]\n", (int)ILThreadSelf());
! 
                        GC_invoke_finalizers();
! 
                        GC_TRACE("GC:_FinalizerThread: Finalizers finished 
[thread:%d]\n", (int)ILThreadSelf());
                }
                
                if (_FinalizerStopFlag)
--- 99,117 ----
                GC_TRACE("GC:_FinalizerThread: Signal [thread:%d]\n", 
(int)ILThreadSelf());
  
!               /* This *must* to be set before checking for 
!_FinalizersDisabled to prevent
!                   a race with ILGCDisableFinalizers */
! 
!               _FinalizersRunning = 1;
! 
!               if (GC_should_invoke_finalizers() && !_FinalizersDisabled)
                {
                        GC_TRACE("GC:_FinalizerThread: Finalizers running 
[thread:%d]\n", (int)ILThreadSelf());
!                       
                        GC_invoke_finalizers();
!                       
                        GC_TRACE("GC:_FinalizerThread: Finalizers finished 
[thread:%d]\n", (int)ILThreadSelf());
                }
+ 
+               _FinalizersRunning = 0;
                
                if (_FinalizerStopFlag)
***************
*** 110,114 ****
  
                        ILWaitEventReset(_FinalizerSignal);
!                       ILWaitEventSet(_FinalizerResponse);
                        
                        return;
--- 122,127 ----
  
                        ILWaitEventReset(_FinalizerSignal);
!                       /* Wake all waiting threads */
!                       ILWaitEventPulse(_FinalizerResponse);
                        
                        return;
***************
*** 118,122 ****
  
                ILWaitEventReset(_FinalizerSignal);
!               ILWaitEventSet(_FinalizerResponse);
        }
  }
--- 131,136 ----
  
                ILWaitEventReset(_FinalizerSignal);
!               /* Wake all waiting threads */
!               ILWaitEventPulse(_FinalizerResponse);
        }
  }
***************
*** 157,161 ****
  static int PrivateGCNotifyFinalize(int timeout)
  {
!       if (FinalizersDisabled)
        {
                return 0;
--- 171,175 ----
  static int PrivateGCNotifyFinalize(int timeout)
  {
!       if (_FinalizersDisabled)
        {
                return 0;
***************
*** 211,220 ****
        /* Signal the finalizer thread */
  
!       ILWaitEventSet(_FinalizerSignal);
  
!       GC_TRACE("ILGCInvokeFinalizers: Invoked finalizers and waiting [thread: 
%d]\n", (int)ILThreadSelf());
!               
!       /* Wait until finalizers have finished */
!       ILWaitOne(_FinalizerResponse, timeout);
        
        GC_TRACE("ILGCInvokeFinalizers: Finalizers finished[thread: %d]\n", 
(int)ILThreadSelf());
--- 225,231 ----
        /* Signal the finalizer thread */
  
!       GC_TRACE("ILGCInvokeFinalizers: Invoking finalizers and waiting 
[thread: %d]\n", (int)ILThreadSelf());
  
!       ILSignalAndWait(_FinalizerSignal, _FinalizerResponse, timeout);
        
        GC_TRACE("ILGCInvokeFinalizers: Finalizers finished[thread: %d]\n", 
(int)ILThreadSelf());
***************
*** 241,245 ****
        GC_java_finalization = 1;
        GC_finalizer_notifier = GCNotifyFinalize;
!       FinalizersDisabled = 0;
  
        _ILMutexCreate(&_FinalizerLock);
--- 252,256 ----
        GC_java_finalization = 1;
        GC_finalizer_notifier = GCNotifyFinalize;
!       _FinalizersDisabled = 0;
  
        _ILMutexCreate(&_FinalizerLock);
***************
*** 270,285 ****
        /* Do a final GC */
        ILGCCollect();
- 
-       GC_TRACE("ILGCDeinit: Peforming last finalizer run [thread:%d]\n", 
(int)ILThreadSelf());
- 
-       /* Wait up to 10 seconds for the finalizers to run */           
-       if (GC_should_invoke_finalizers())
-       {
-               PrivateGCNotifyFinalize(10000);
-       }
-       
        /* Cleanup the finalizer thread */
        if (_FinalizerThread && _FinalizerThreadStarted)
        {
                GC_TRACE("ILGCDeinit: Waiting for finalizer thread to end 
[thread:%d]\n", (int)ILThreadSelf());
  
--- 281,291 ----
        /* Do a final GC */
        ILGCCollect();
        /* Cleanup the finalizer thread */
        if (_FinalizerThread && _FinalizerThreadStarted)
        {
+               GC_TRACE("ILGCDeinit: Peforming last finalizer run 
[thread:%d]\n", (int)ILThreadSelf());
+ 
+               ILWaitEventSet(_FinalizerSignal);
+               
                GC_TRACE("ILGCDeinit: Waiting for finalizer thread to end 
[thread:%d]\n", (int)ILThreadSelf());
  
***************
*** 358,367 ****
  void ILGCDisableFinalizers(void)
  {
!       FinalizersDisabled = 1;
  }
  
  void ILGCEnableFinalizers(void)
  {
!       FinalizersDisabled = 0;
  }
  
--- 364,379 ----
  void ILGCDisableFinalizers(void)
  {
!       _FinalizersDisabled = 1;
! 
!       if (_FinalizersRunning && ILHasThreads())
!       {
!               /* Invoke and wait so we can guarantee no finalizers will run 
after this method ends */
!               PrivateGCNotifyFinalize(-1);
!       }
  }
  
  void ILGCEnableFinalizers(void)
  {
!       _FinalizersDisabled = 0;
  }
  

Index: no_defs.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/no_defs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** no_defs.c   27 Apr 2002 12:29:20 -0000      1.2
--- no_defs.c   15 Jul 2003 22:17:33 -0000      1.3
***************
*** 41,44 ****
--- 41,53 ----
  }
  
+ void _ILThreadSetPriority(ILThread *thread, int priority)
+ {
+ }
+ 
+ int _ILThreadGetPriority(ILThread *thread)
+ {
+       return IL_TP_NORMAL;
+ }
+ 
  int _ILCondVarTimedWait(_ILCondVar *cond, _ILCondMutex *mutex, ILUInt32 ms)
  {

Index: pt_defs.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/pt_defs.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** pt_defs.c   15 May 2003 02:46:28 -0000      1.6
--- pt_defs.c   15 Jul 2003 22:17:33 -0000      1.7
***************
*** 160,163 ****
--- 160,172 ----
  }
  
+ void _ILThreadSetPriority(ILThread *thread, int priority)
+ {
+ }
+ 
+ int _ILThreadGetPriority(ILThread *thread)
+ {
+       return IL_TP_NORMAL;
+ }
+ 
  /*
   * Entry point for a pthread.  This initializes the thread

Index: thr_defs.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/thr_defs.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** thr_defs.h  7 Jul 2003 19:44:05 -0000       1.7
--- thr_defs.h  15 Jul 2003 22:17:33 -0000      1.8
***************
*** 166,169 ****
--- 166,171 ----
                                                                         int 
release);
  
+ typedef int (*ILWaitSignalFunc)(ILWaitHandle *handle);
+ 
  /*
   * Internal structure of a wait handle.
***************
*** 176,180 ****
        ILWaitRegisterFunc       volatile registerFunc;
        ILWaitUnregisterFunc volatile unregisterFunc;
! 
  };
  
--- 178,182 ----
        ILWaitRegisterFunc       volatile registerFunc;
        ILWaitUnregisterFunc volatile unregisterFunc;
!     ILWaitSignalFunc           volatile signalFunc;
  };
  
***************
*** 328,331 ****
--- 330,343 ----
  
  /*
+  *    Sets the priority of the thread.
+  */
+ void _ILThreadSetPriority(ILThread *thread, int priority);
+ 
+ /*
+  *    Gets the thread priority.
+  */
+ int _ILThreadGetPriority(ILThread *thread);
+ 
+ /*
   * Create a thread wakeup object.
   */
***************
*** 367,370 ****
--- 379,384 ----
   */
  void _ILWakeupInterrupt(_ILWakeup *wakeup);
+ 
+ void _ILWakeupCancelInterrupt(_ILWakeup *wakeup);
  
  /*

Index: thread.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/thread.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** thread.c    8 Jul 2003 12:05:17 -0000       1.13
--- thread.c    15 Jul 2003 22:17:33 -0000      1.14
***************
*** 125,133 ****
        }
  
!       /* Mark the thread as stopped, and wakeup everyone waiting to join */
        _ILMutexLock(&(thread->lock));
        thread->state |= IL_TS_STOPPED;
!       isbg = ((thread->state & IL_TS_BACKGROUND) != 0);
!       _ILWakeupQueueWakeAll(&(thread->joinQueue));
        _ILMutexUnlock(&(thread->lock));
  
--- 125,132 ----
        }
  
!       /* Mark the thread as stopped */
        _ILMutexLock(&(thread->lock));
        thread->state |= IL_TS_STOPPED;
!       isbg = ((thread->state & IL_TS_BACKGROUND) != 0);       
        _ILMutexUnlock(&(thread->lock));
  
***************
*** 148,151 ****
--- 147,155 ----
        }
  
+       /* Wakeup everyone waiting to join */
+       _ILMutexLock(&(thread->lock));
+       _ILWakeupQueueWakeAll(&(thread->joinQueue));
+       _ILMutexUnlock(&(thread->lock));
+ 
        /* Update the thread counts */
        _ILMutexLock(&threadLockAll);
***************
*** 181,184 ****
--- 185,189 ----
                return 0;
        }
+ 
        _ILMutexCreate(&(thread->lock));
        thread->state = IL_TS_UNSTARTED;
***************
*** 492,496 ****
                        result = 0;
                }
!                       else if((thread->state & IL_TS_ABORT_REQUESTED) != 0)
                {
                        /* Abort was requested */
--- 497,501 ----
                        result = 0;
                }
!               else if((thread->state & IL_TS_ABORT_REQUESTED) != 0)
                {
                        /* Abort was requested */
***************
*** 561,564 ****
--- 566,573 ----
        {
                thread->state &= ~(IL_TS_ABORTED | IL_TS_ABORT_REQUESTED);
+               thread->state &= ~(IL_TS_INTERRUPTED);
+ 
+               _ILWakeupCancelInterrupt(&thread->wakeup);
+ 
                result = 1;
        }
***************
*** 977,980 ****
--- 986,999 ----
  
        return -1;
+ }
+ 
+ void ILThreadSetPriority(ILThread *thread, int priority)
+ {
+       _ILThreadSetPriority(thread, priority);
+ }
+ 
+ int ILThreadGetPriority(ILThread *thread)
+ {
+       _ILThreadGetPriority(thread);
  }
  

Index: w32_defs.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/w32_defs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** w32_defs.c  27 Apr 2002 12:29:20 -0000      1.2
--- w32_defs.c  15 Jul 2003 22:17:33 -0000      1.3
***************
*** 21,25 ****
  #include "thr_defs.h"
  
! #ifdef        IL_USE_WIN32_THREADS
  
  #ifdef        __cplusplus
--- 21,25 ----
  #include "thr_defs.h"
  
! #ifdef         IL_USE_WIN32_THREADS
  
  #ifdef        __cplusplus
***************
*** 31,34 ****
--- 31,88 ----
   */
  DWORD _ILThreadObjectKey;
+ 
+ /*
+  *    Sets the thread priority.
+  */
+ void _ILThreadSetPriority(ILThread *thread, int priority)
+ {
+       switch (priority)
+       {
+       case IL_TP_LOWEST:
+               SetThreadPriority(thread->handle, THREAD_PRIORITY_LOWEST);
+               break;
+       case IL_TP_BELOW_NORMAL:
+               SetThreadPriority(thread->handle, THREAD_PRIORITY_BELOW_NORMAL);
+               break;
+       case IL_TP_NORMAL:
+               SetThreadPriority(thread->handle, THREAD_PRIORITY_NORMAL);
+               break;
+       case IL_TP_ABOVE_NORMAL:
+               SetThreadPriority(thread->handle, THREAD_PRIORITY_ABOVE_NORMAL);
+               break;
+       case IL_TP_HIGHEST:
+               SetThreadPriority(thread->handle, THREAD_PRIORITY_HIGHEST);
+               break;
+       }       
+ }
+ 
+ /*
+  *    Gets the thread priority.
+  */
+ int _ILThreadGetPriority(ILThread *thread)
+ {
+       switch (GetThreadPriority(thread->handle))
+       {
+       case THREAD_PRIORITY_IDLE:
+       case THREAD_PRIORITY_LOWEST:            
+               return IL_TP_LOWEST;
+ 
+       case THREAD_PRIORITY_BELOW_NORMAL:              
+               return IL_TP_BELOW_NORMAL;
+ 
+       case THREAD_PRIORITY_NORMAL:            
+               return IL_TP_NORMAL;
+ 
+       case THREAD_PRIORITY_ABOVE_NORMAL:              
+               return IL_TP_ABOVE_NORMAL;
+ 
+       case THREAD_PRIORITY_HIGHEST:
+       case THREAD_PRIORITY_TIME_CRITICAL:
+               return IL_TP_HIGHEST;
+ 
+       default:
+               return IL_TP_NORMAL;
+       }
+ }
  
  void _ILThreadInitSystem(ILThread *mainThread)

Index: wait.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/wait.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** wait.c      26 Jun 2003 03:39:25 -0000      1.4
--- wait.c      15 Jul 2003 22:17:33 -0000      1.5
***************
*** 65,75 ****
  {
        _ILMutexLock(&(thread->lock));
!       if((thread->state & IL_TS_INTERRUPTED) != 0)
        {
!               result = IL_WAIT_INTERRUPTED;
        }
!       else if((thread->state & (IL_TS_ABORTED | IL_TS_ABORT_REQUESTED)) != 0)
        {
!               result = IL_WAIT_ABORTED;
        }
        thread->state &= ~(IL_TS_WAIT_SLEEP_JOIN | IL_TS_INTERRUPTED);
--- 65,76 ----
  {
        _ILMutexLock(&(thread->lock));
!       /* Abort has more priority over interrupt */
!       if((thread->state & (IL_TS_ABORTED | IL_TS_ABORT_REQUESTED)) != 0)
        {
!               result = IL_WAIT_ABORTED;
        }
!       else if((thread->state & IL_TS_INTERRUPTED) != 0)
        {
!               result = IL_WAIT_INTERRUPTED;
        }
        thread->state &= ~(IL_TS_WAIT_SLEEP_JOIN | IL_TS_INTERRUPTED);
***************
*** 98,101 ****
--- 99,167 ----
  }
  
+ int ILSignalAndWait(ILWaitHandle *signalHandle, ILWaitHandle *waitHandle, 
ILUInt32 timeout)
+ {
+       ILThread *thread = ILThreadSelf();
+       _ILWakeup *wakeup = &(thread->wakeup);
+       int result;
+ 
+       /* Enter the "wait/sleep/join" state */
+       result = EnterWait(thread);
+       if(result != 0)
+       {
+               return result;
+       }
+ 
+       if (signalHandle->signalFunc == 0)
+       {
+               return IL_WAIT_FAILED;
+       }
+ 
+       /* Set the limit for the thread's wakeup object */
+       if(!_ILWakeupSetLimit(wakeup, 1))
+       {
+               return LeaveWait(thread, IL_WAIT_INTERRUPTED);
+       }
+ 
+       /* Register this thread with the handle */
+       result = (*(waitHandle->registerFunc))(waitHandle, wakeup);
+               
+       signalHandle->signalFunc(signalHandle);
+       
+       if(result == IL_WAITREG_ACQUIRED)
+       {
+               /* We were able to acquire the wait handle immediately */
+               _ILWakeupAdjustLimit(wakeup, 0);                
+               return LeaveWaitHandle(thread, waitHandle, 0);
+       }
+       else if(result == IL_WAITREG_FAILED)
+       {
+               /* Something serious happened which prevented registration */
+               _ILWakeupAdjustLimit(wakeup, 0);
+               return LeaveWait(thread, IL_WAIT_FAILED);
+       }
+ 
+       /* Wait until we are signalled, timed out, or interrupted */
+       result = _ILWakeupWait(wakeup, timeout, 0);
+ 
+       /* Unregister the thread from the wait handle */
+       (*(waitHandle->unregisterFunc))(waitHandle, wakeup, (result <= 0));
+ 
+       /* Tell the caller what happened */
+       if(result > 0)
+       {
+               /* We have to account for "LeaveWait" detecting interrupt
+               or abort after we already acquired the wait handle */
+               return LeaveWaitHandle(thread, waitHandle, 0);
+       }
+       else if(result == 0)
+       {
+               return LeaveWait(thread, IL_WAIT_TIMEOUT);
+       }
+       else
+       {
+               return LeaveWait(thread, IL_WAIT_INTERRUPTED);
+       }
+ }
+ 
  int ILWaitOne(ILWaitHandle *handle, ILUInt32 timeout)
  {
***************
*** 133,137 ****
        }
  
- 
        /* Wait until we are signalled, timed out, or interrupted */
        result = _ILWakeupWait(wakeup, timeout, 0);
--- 199,202 ----
***************
*** 304,309 ****
        if (limit == 0)
        {
!               /* No need to wait since we managed to aquire every handle 
immediately. */
!               
                result = 1;
        }
--- 369,373 ----
        if (limit == 0)
        {
!               /* No need to wait since we managed to aquire every handle 
immediately. */              
                result = 1;
        }

Index: wait_event.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/wait_event.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** wait_event.c        7 Dec 2002 10:46:55 -0000       1.1
--- wait_event.c        15 Jul 2003 22:17:33 -0000      1.2
***************
*** 22,25 ****
--- 22,26 ----
  
  #include "thr_defs.h"
+ #include "stdio.h"
  
  #ifdef        __cplusplus
***************
*** 98,101 ****
--- 99,107 ----
  }
  
+ static int EventSignal(ILWaitHandle *waitHandle)
+ {
+       ILWaitEventSet(waitHandle);
+ }
+ 
  /*
   * Creates and returns a new wait event.
***************
*** 124,127 ****
--- 130,134 ----
        event->parent.registerFunc = (ILWaitRegisterFunc)EventRegister;
        event->parent.unregisterFunc = (ILWaitUnregisterFunc)EventUnregister;
+       event->parent.signalFunc = (ILWaitSignalFunc)EventSignal;
  
        _ILWakeupQueueCreate(&(event->queue));
***************
*** 162,177 ****
                        if (event->data & (EVENT_MANUALRESET_MASK))
                        {
-                               /* Manual reset events should be set to 
signalled here
-                                * Auto reset events shouldn't be set since a 
thread is
-                                * about to be released. */
- 
                                event->data |= (EVENT_SET_MASK);
-                       }
  
!                       /* Wakeup the next thread */
!                       _ILWakeupQueueWake(&event->queue);
                }
        }
        
        /* Unlock the event and return */
        _ILMutexUnlock(&(event->parent.lock));
--- 169,225 ----
                        if (event->data & (EVENT_MANUALRESET_MASK))
                        {
                                event->data |= (EVENT_SET_MASK);
  
!                               _ILWakeupQueueWakeAll(&event->queue);
!                       }
!                       else
!                       {
!                               /* No need to set the event mask since a single 
thread is going to be released */
!                               _ILWakeupQueueWake(&event->queue);
!                       }
                }
        }
        
+       /* Unlock the event and return */
+       _ILMutexUnlock(&(event->parent.lock));
+ 
+       return 1;
+ }
+ 
+ /*
+ * Pulses the event.
+ *
+ * @param handle  The pointer to the wait event.
+ * @returns 1 if successful.
+ */
+ int ILWaitEventPulse(ILWaitHandle *handle)
+ {
+       ILWaitEvent *event = (ILWaitEvent *)handle;
+ 
+       /* Lock down the event */
+       _ILMutexLock(&(event->parent.lock));
+ 
+       if (!(event->data & (EVENT_SET_MASK)))
+       {               
+               if (event->queue.first == 0)
+               {
+                       /* No threads are waiting so just exit */
+               }
+               else
+               {
+                       /* One or more threads must be waiting */
+ 
+                       /* Check if this event is manually reset */
+                       if (event->data & (EVENT_MANUALRESET_MASK))
+                       {
+                               _ILWakeupQueueWakeAll(&event->queue);
+                       }
+                       else
+                       {                               
+                               _ILWakeupQueueWake(&event->queue);
+                       }
+               }
+       }
+ 
        /* Unlock the event and return */
        _ILMutexUnlock(&(event->parent.lock));

Index: wait_mutex.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/wait_mutex.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** wait_mutex.c        26 Jun 2003 22:23:35 -0000      1.5
--- wait_mutex.c        15 Jul 2003 22:17:33 -0000      1.6
***************
*** 195,198 ****
--- 195,203 ----
  }
  
+ static int MutexSignal(ILWaitHandle *waitHandle)
+ {
+       return ILWaitMutexRelease(waitHandle) > 0;
+ }
+ 
  ILWaitHandle *ILWaitMutexCreate(int initiallyOwned)
  {
***************
*** 211,214 ****
--- 216,221 ----
        mutex->parent.registerFunc = (ILWaitRegisterFunc)MutexRegister;
        mutex->parent.unregisterFunc = (ILWaitUnregisterFunc)MutexUnregister;
+       mutex->parent.signalFunc = MutexSignal;
+ 
        if(initiallyOwned)
        {
***************
*** 314,317 ****
--- 321,325 ----
        mutex->parent.parent.registerFunc = (ILWaitRegisterFunc)MutexRegister;
        mutex->parent.parent.unregisterFunc = 
(ILWaitUnregisterFunc)MutexUnregister;
+       mutex->parent.parent.signalFunc = MutexSignal;
        if(initiallyOwned)
        {
***************
*** 402,406 ****
        {
                /* The current thread still owns the mutex */
!               result = 1;
        }
  
--- 410,414 ----
        {
                /* The current thread still owns the mutex */
!               result = IL_WAIT_LEAVE_STILL_OWNS;
        }
  
***************
*** 454,457 ****
--- 462,466 ----
        monitor->parent.parent.unregisterFunc =
                        (ILWaitUnregisterFunc)MutexUnregister;
+       monitor->parent.parent.signalFunc = MutexSignal;
        monitor->parent.owner = 0;
        monitor->parent.count = 0;

Index: wakeup.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/wakeup.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** wakeup.c    12 Jul 2003 06:41:54 -0000      1.6
--- wakeup.c    15 Jul 2003 22:17:33 -0000      1.7
***************
*** 248,251 ****
--- 248,266 ----
  }
  
+ void _ILWakeupCancelInterrupt(_ILWakeup *wakeup)
+ {
+       /* Lock down the wakeup object */
+       _ILCondMutexLock(&(wakeup->lock));
+       
+       if(wakeup->interrupted)
+       {
+               /* Mark the thread for interruption */
+               wakeup->interrupted = 0;
+       }
+ 
+       /* Unlock the wakeup object */
+       _ILCondMutexUnlock(&(wakeup->lock));
+ }
+ 
  void _ILWakeupQueueCreate(_ILWakeupQueue *queue)
  {





reply via email to

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