harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r774985 - /harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/unix/thrdsup.h
Date Fri, 15 May 2009 02:12:20 GMT
Author: ndbeyer
Date: Fri May 15 02:12:19 2009
New Revision: 774985

URL: http://svn.apache.org/viewvc?rev=774985&view=rev
Log:
add checks for MACOSX and inline a define

Modified:
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/unix/thrdsup.h

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/unix/thrdsup.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/unix/thrdsup.h?rev=774985&r1=774984&r2=774985&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/unix/thrdsup.h
(original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/thread/unix/thrdsup.h
Fri May 15 02:12:19 2009
@@ -26,7 +26,7 @@
 #include <setjmp.h>
 #include "hycomp.h"
 
-#if (defined(LINUX))
+#if defined(LINUX) || defined(MACOSX)
 #include <sys/time.h>
 #endif
 
@@ -38,7 +38,7 @@
 #define WRAPPER_TYPE void*
 typedef void *WRAPPER_ARG;
 #define WRAPPER_RETURN() return NULL
-#if defined(LINUX) || defined(FREEBSD)
+#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX)
 #include <semaphore.h>
 typedef sem_t OSSEMAPHORE;
 #else
@@ -73,9 +73,7 @@
 #define HYDIV div
 /* do we really need nanosecond clock accuracy even on platforms which support gettime? */
 
-#define TIMEOUT_CLOCK CLOCK_REALTIME
-
-#if (defined(LINUX))
+#if defined(LINUX) || defined(MACOSX)
 #define SETUP_TIMEOUT(ts_, millis, nanos) {								\
 		struct timeval tv_;											\
 		HYDIV_T secs_ = HYDIV(millis, 1000);					\
@@ -107,7 +105,7 @@
 #define SETUP_TIMEOUT(ts_, millis, nanos) {								\
 		HYDIV_T secs_ = HYDIV(millis, 1000);					\
 		int nanos_ = secs_.rem * 1000000 + nanos;				\
- 		clock_gettime(TIMEOUT_CLOCK, &ts_);		\
+ 		clock_gettime(CLOCK_REALTIME, &ts_);		\
 		nanos_ += ts_.tv_nsec;									\
 		if (nanos_ >= 1000000000) {							\
 			ts_.tv_sec += secs_.quot + 1;						\
@@ -142,7 +140,7 @@
 #define THREAD_SELF() (pthread_self())
 
 /* THREAD_YIELD */
-#if defined(LINUX) || defined(FREEBSD)
+#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX)
 #define THREAD_YIELD() (sched_yield())
 #endif
 
@@ -202,54 +200,54 @@
 #define THREAD_SET_PRIORITY(thread, priority) set_pthread_priority((thread), (priority))
 
 /* SEM_CREATE */
-#if defined(LINUX) || defined(FREEBSD)
+#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX)
 #define SEM_CREATE(initValue) thread_malloc(NULL, sizeof(OSSEMAPHORE))
 #else
 #define SEM_CREATE(initValue)
 #endif
 
 /* SEM_INIT */
-#if defined(LINUX) || defined(FREEBSD)
+#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX)
 #define SEM_INIT(sm, pshrd, inval)	(sem_init((sem_t*)sm, pshrd, inval))
 #else
 #define SEM_INIT(sm,pshrd,inval)
 #endif
 
 /* SEM_DESTROY */
-#if defined(LINUX) || defined(FREEBSD)
+#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX)
 #define SEM_DESTROY(sm)	(sem_destroy((sem_t*)sm))
 #else
 #define SEM_DESTROY(sm)
 #endif
 
 /* SEM_FREE */
-#if defined(LINUX) || defined(FREEBSD)
+#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX)
 #define	SEM_FREE(s)  	thread_free(NULL, (sem_t*)s);
 #endif
 
 /* SEM_POST */
-#if defined(LINUX) || defined(FREEBSD)
+#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX)
 #define SEM_POST(smP)	(sem_post((sem_t*)smP))
 #else
 #define SEM_POST(sm)
 #endif
 
 /* SEM_WAIT */
-#if defined(LINUX) || defined(FREEBSD)
+#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX)
 #define SEM_WAIT(smP)	(sem_wait((sem_t*)smP))
 #else
 #define SEM_WAIT(sm)
 #endif
 
 /* SEM_TRYWAIT */
-#if defined(LINUX) || defined(FREEBSD)
+#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX)
 #define SEM_TRYWAIT(smP)	(sem_trywait(smP))
 #else
 #define SEM_TRYWAIT(sm)
 #endif
 
 /* SEM_GETVALUE */
-#if defined(LINUX) || defined(FREEBSD)
+#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX)
 #define SEM_GETVALUE(smP, intP)	(sem_getvalue(smP, intP))
 #else
 #define SEM_GETVALUE(sm)



Mime
View raw message