Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce the unimplemented part
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 23 Oct 2007 13:51:24 +0000 (13:51 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 23 Oct 2007 13:51:24 +0000 (13:51 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4863 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/xbt/xbt_os_thread.c

index 52b7673..8114e84 100644 (file)
@@ -316,10 +316,6 @@ xbt_os_sem_acquire(xbt_os_sem_t sem)
 
 void xbt_os_sem_timedacquire(xbt_os_sem_t sem,double timeout)
 {
-       /* mac os x have not the sem_timedwait() function */
-       #ifndef HAVE_SEM_TIMEDWAIT
-       THROW_UNIMPLEMENTED;
-       #else
        int errcode;
        struct timespec ts_end;
        double end = timeout + xbt_os_time();
@@ -333,6 +329,10 @@ void xbt_os_sem_timedacquire(xbt_os_sem_t sem,double timeout)
        } 
        else 
        {
+       /* mac os x have not the sem_timedwait() function */
+#ifndef HAVE_SEM_TIMEDWAIT
+       THROW_UNIMPLEMENTED;
+#else
                ts_end.tv_sec = (time_t) floor(end);
                ts_end.tv_nsec = (long)  ( ( end - ts_end.tv_sec) * 1000000000);
                DEBUG2("sem_timedwait(%p,%p)",&(sem->s),&ts_end);
@@ -348,8 +348,8 @@ void xbt_os_sem_timedacquire(xbt_os_sem_t sem,double timeout)
                        default:
                        THROW3(system_error,errcode,"sem_timedwait(%p,%f) failed: %s",sem,timeout, strerror(errcode));
                }   
+#endif
        }
-       #endif
 }
 
 void