[libdispatch-dev] Solaris portability, dispatch.h - PATCH [6/6]
Joakim Johansson
jocke at tbricks.com
Fri Nov 6 07:01:49 PST 2009
There is a type mismatch here agin, pthread_t is not a pointer on
Solaris, but an unsigned int, so we need a different formatting string.
We also need to include additional headers.
Joakim
> svn diff internal.h
Index: internal.h
===================================================================
--- internal.h (revision 140)
+++ internal.h (working copy)
@@ -116,6 +119,8 @@
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
+#include <strings.h>
#define DISPATCH_NOINLINE __attribute__((noinline))
@@ -225,6 +230,16 @@
/* Make sure the debug statments don't get too stale */
+/* pthread_t is an integer on Solaris, need a different formatting
string */
+#if defined (__SVR4) && defined (__sun)
+#define _dispatch_debug(x, args...) \
+({ \
+ if (DISPATCH_DEBUG) { \
+ _dispatch_log("libdispatch: %u\t%d\t" x, __LINE__, \
+ _dispatch_thread_self(), ##args); \
+ } \
+})
+#else
#define _dispatch_debug(x, args...) \
({ \
if (DISPATCH_DEBUG) { \
@@ -232,7 +247,7 @@
(void *)_dispatch_thread_self(), ##args); \
} \
})
-
+#endif
uint64_t _dispatch_get_nanoseconds(void);
More information about the libdispatch-dev
mailing list