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

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

[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and to


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and tools (pnet) branch, master, updated. c3ac178896b2603e34654237bc0bfdb9b7b4c9e3
Date: Sun, 10 Jan 2010 18:36:15 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "DotGNU Portable.NET engine, compilers and tools (pnet)".

The branch, master has been updated
       via  c3ac178896b2603e34654237bc0bfdb9b7b4c9e3 (commit)
      from  fffcb315d040a6cc6792e2994f906570cea924ec (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/pnet.git/commit/?id=c3ac178896b2603e34654237bc0bfdb9b7b4c9e3

commit c3ac178896b2603e34654237bc0bfdb9b7b4c9e3
Author: Klaus Treichel <address@hidden>
Date:   Sun Jan 10 19:35:54 2010 +0100

    Disable longjumps out of signal handling functions for NetBSD.
    Fix build if longjumps out of signal handlers is not supported by the os.

diff --git a/ChangeLog b/ChangeLog
index 4d40841..df81bf5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-01-10  Klaus Treichel  <address@hidden>
+
+       * support/pt_defs.h: Disable longjmp out of signal handler for NetBSD.
+
+       * support/pt_defs.c: Fix build if longjmp out of signal handler is not
+       supported.
+
 2009-12-31  Klaus Treichel  <address@hidden>
 
        * engine/engine.h (_ILExecThreadClearExecutionState): Add prototype.
diff --git a/support/pt_defs.c b/support/pt_defs.c
index 4f55054..6123a13 100755
--- a/support/pt_defs.c
+++ b/support/pt_defs.c
@@ -304,6 +304,98 @@ static void AbortSignal(int sig)
 }
 
 /*
+ * Define some functions from the Timeouts options that need not be provided
+ * in all implementations.
+ */
+
+#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
+int pthread_mutex_timedlock (pthread_mutex_t *mutex,
+                           const struct timespec *abs_timeout)
+{
+       int retcode;
+#ifdef HAVE_NANOSLEEP
+       struct timespec ts;
+       
+       /* To avoid a completely busy wait we sleep for 10 ms between two 
tries. */
+       /* As a consequence the resolution is at most 10 ms instead of 1 ms. */
+       ts.tv_sec = 0;
+       ts.tv_nsec = 10000000;  /* 10ms */
+#endif /* HAVE_NANOSLEEP */
+       
+       while((retcode = pthread_mutex_trylock(mutex)) == EBUSY)
+       {
+               struct timeval tv;
+
+               gettimeofday(&tv, NULL);
+               
+               if((tv.tv_sec > abs_timeout->tv_sec) ||
+                  (tv.tv_sec == abs_timeout->tv_sec &&
+                   (tv.tv_usec * 1000) >= abs_timeout->tv_nsec))
+               {
+                       return ETIMEDOUT;
+               }
+#ifdef HAVE_NANOSLEEP
+               nanosleep(&ts, NULL);
+#else /* !HAVE_NANOSLEEP */
+#ifdef HAVE_USLEEP
+                       usleep(10000);  /* 10 ms */
+#else /* !HAVE_USLEEP */
+#error "neither nanosleep nor usleep are available on this system"
+#endif /* !HAVE_USLEEP */
+#endif /* !HAVE_NANOSLEEP */
+       }
+       return retcode;
+}
+#endif /* !HAVE_PTHREAD_MUTEX_TIMEDLOCK */
+
+#ifndef HAVE_SEM_TIMEDWAIT
+int sem_timedwait(sem_t *sem,
+                                 const struct timespec *abs_timeout)
+{
+#ifdef HAVE_NANOSLEEP
+       struct timespec ts;
+       
+       /* To avoid a completely busy wait we sleep for 10 ms between two 
tries. */
+       /* As a consequence the resolution is at most 10 ms instead of 1 ms. */
+       ts.tv_sec = 0;
+       ts.tv_nsec = 10000000;  /* 10ms */
+#endif /* HAVE_NANOSLEEP */
+
+       while(sem_trywait(sem) == -1)
+       {
+               if(errno == EAGAIN)
+               {
+                       struct timeval tv;
+
+                       gettimeofday(&tv, NULL);
+               
+                       if((tv.tv_sec > abs_timeout->tv_sec) ||
+                          (tv.tv_sec == abs_timeout->tv_sec &&
+                           (tv.tv_usec * 1000) >= abs_timeout->tv_nsec))
+                       {
+                               errno = ETIMEDOUT;
+                               return -1;
+                       }
+#ifdef HAVE_NANOSLEEP
+                       if(nanosleep(&ts, NULL) != 0)
+                       {
+                               /* Looks like we got interrupted */
+                               return -1;
+                       }
+#else /* !HAVE_NANOSLEEP */
+#error "nanosleep is needed for implementing an interruptible sleep"
+#endif /* !HAVE_NANOSLEEP */
+               }
+               else
+               {
+                       return -1;
+               }
+       }
+       return 0;
+}
+#endif /* !HAVE_SEM_TIMEDWAIT */
+
+/*
  * Interruptible wait on a semaphore.
  */
 static int SemWaitInterruptible(sem_t *sem)
@@ -322,7 +414,7 @@ static int SemWaitInterruptible(sem_t *sem)
                {
 #ifndef _IL_PT_INTERRUPT_JMP
                        __threadState = 
ILInterlockedLoadU2(&(__myThread->state.split.priv));
-                       if((threadState & IL_TS_INTERRUPTED) != 0)
+                       if((__threadState & IL_TS_INTERRUPTED) != 0)
                        {
                                break;
                        }
@@ -371,8 +463,8 @@ static int SemTimedWaitInterruptible(sem_t *sem, ILUInt32 
ms)
                else if(errno == EINTR)
                {
 #ifndef _IL_PT_INTERRUPT_JMP
-                       __threadState = 
ILInterlockedLoadU2(&(thread->state.split.priv));
-                       if((threadState & IL_TS_INTERRUPTED) != 0)
+                       __threadState = 
ILInterlockedLoadU2(&(__myThread->state.split.priv));
+                       if((__threadState & IL_TS_INTERRUPTED) != 0)
                        {
                                break;
                        }
@@ -614,7 +706,7 @@ int _ILThreadSleep(ILUInt32 ms)
                                {
 #ifndef _IL_PT_INTERRUPT_JMP
                                        /* Check and clear the interrupted flag 
*/
-                                       __threadState = 
ILInterlockedLoadU2(&(thread->state.split.priv));
+                                       __threadState = 
ILInterlockedLoadU2(&(__myThread->state.split.priv));
                                        if((__threadState | IL_TS_INTERRUPTED) 
!= 0)
                                        {
                                                result = 
IL_THREAD_ERR_INTERRUPT;
@@ -689,98 +781,6 @@ int _ILCondVarTimedWait(_ILCondVar *cond, _ILCondMutex 
*mutex, ILUInt32 ms)
        }
 }
 
-/*
- * Define some functions from the Timeouts options that need not be provided
- * in all implementations.
- */
-
-#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
-int pthread_mutex_timedlock (pthread_mutex_t *mutex,
-                           const struct timespec *abs_timeout)
-{
-       int retcode;
-#ifdef HAVE_NANOSLEEP
-       struct timespec ts;
-       
-       /* To avoid a completely busy wait we sleep for 10 ms between two 
tries. */
-       /* As a consequence the resolution is at most 10 ms instead of 1 ms. */
-       ts.tv_sec = 0;
-       ts.tv_nsec = 10000000;  /* 10ms */
-#endif /* HAVE_NANOSLEEP */
-       
-       while((retcode = pthread_mutex_trylock(mutex)) == EBUSY)
-       {
-               struct timeval tv;
-
-               gettimeofday(&tv, NULL);
-               
-               if((tv.tv_sec > abs_timeout->tv_sec) ||
-                  (tv.tv_sec == abs_timeout->tv_sec &&
-                   (tv.tv_usec * 1000) >= abs_timeout->tv_nsec))
-               {
-                       return ETIMEDOUT;
-               }
-#ifdef HAVE_NANOSLEEP
-               nanosleep(&ts, NULL);
-#else /* !HAVE_NANOSLEEP */
-#ifdef HAVE_USLEEP
-                       usleep(10000);  /* 10 ms */
-#else /* !HAVE_USLEEP */
-#error "neither nanosleep nor usleep are available on this system"
-#endif /* !HAVE_USLEEP */
-#endif /* !HAVE_NANOSLEEP */
-       }
-       return retcode;
-}
-#endif /* !HAVE_PTHREAD_MUTEX_TIMEDLOCK */
-
-#ifndef HAVE_SEM_TIMEDWAIT
-int sem_timedwait(sem_t *sem,
-                                 const struct timespec *abs_timeout)
-{
-#ifdef HAVE_NANOSLEEP
-       struct timespec ts;
-       
-       /* To avoid a completely busy wait we sleep for 10 ms between two 
tries. */
-       /* As a consequence the resolution is at most 10 ms instead of 1 ms. */
-       ts.tv_sec = 0;
-       ts.tv_nsec = 10000000;  /* 10ms */
-#endif /* HAVE_NANOSLEEP */
-
-       while(sem_trywait(sem) == -1)
-       {
-               if(errno == EAGAIN)
-               {
-                       struct timeval tv;
-
-                       gettimeofday(&tv, NULL);
-               
-                       if((tv.tv_sec > abs_timeout->tv_sec) ||
-                          (tv.tv_sec == abs_timeout->tv_sec &&
-                           (tv.tv_usec * 1000) >= abs_timeout->tv_nsec))
-                       {
-                               errno = ETIMEDOUT;
-                               return -1;
-                       }
-#ifdef HAVE_NANOSLEEP
-                       if(nanosleep(&ts, NULL) != 0)
-                       {
-                               /* Looks like we got interrupted */
-                               return -1;
-                       }
-#else /* !HAVE_NANOSLEEP */
-#error "nanosleep is needed for implementing an interruptible sleep"
-#endif /* !HAVE_NANOSLEEP */
-               }
-               else
-               {
-                       return -1;
-               }
-       }
-       return 0;
-}
-#endif /* !HAVE_SEM_TIMEDWAIT */
-
 int _ILCondMutexTimedLockUnsafe(_ILCondMutex *mutex, ILUInt32 ms)
 {
        if((ms == IL_MAX_UINT32) || (ms <= IL_MAX_INT32))
diff --git a/support/pt_defs.h b/support/pt_defs.h
index f7e25d0..7d8592f 100755
--- a/support/pt_defs.h
+++ b/support/pt_defs.h
@@ -144,7 +144,8 @@ typedef pthread_mutex_t             _ILRWLock;
 /*
  * Check if we can implement thread interrupts using sigsetjmp and siglongjmp
  */
-#if defined(HAVE_SIGSETJMP) && defined(HAVE_SIGLONGJMP)
+#if defined(HAVE_SIGSETJMP) && defined(HAVE_SIGLONGJMP) && \
+       !defined(__NetBSD__)
 #define _IL_PT_INTERRUPT_JMP
 #endif
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |    7 ++
 support/pt_defs.c |  192 ++++++++++++++++++++++++++--------------------------
 support/pt_defs.h |    3 +-
 3 files changed, 105 insertions(+), 97 deletions(-)


hooks/post-receive
-- 
DotGNU Portable.NET engine, compilers and tools (pnet)




reply via email to

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