[libdispatch-dev] Solaris portability, tsd.h - PATCH [6/6] REVISED
Joakim Johansson
jocke at tbricks.com
Tue Nov 17 07:09:05 PST 2009
I think it seems reasonable to cast to uintptr_t, attached alternative patch to tsd.h below, which means that internal.h doesn't need to be touched.
Joakim
Index: /home/jocke/gcd/trunk/src/shims/tsd.h
===================================================================
--- /home/jocke/gcd/trunk/src/shims/tsd.h (revision 166)
+++ /home/jocke/gcd/trunk/src/shims/tsd.h (working copy)
@@ -115,6 +115,6 @@
}
#endif
-#define _dispatch_thread_self pthread_self
+#define _dispatch_thread_self (uintptr_t) pthread_self
#endif /* __DISPATCH_SHIMS_TSD__ */
On 13 nov 2009, at 15.37, Robert Watson wrote:
>
> On Sat, 7 Nov 2009, Joakim Johansson wrote:
>
>> Index: internal.h
>> ===================================================================
>> --- internal.h (revision 142)
>> +++ internal.h (working copy)
>> @@ -229,11 +235,10 @@
>> ({ \
>> if (DISPATCH_DEBUG) { \
>> _dispatch_log("libdispatch: %u\t%p\t" x, __LINE__, \
>> - (void *)_dispatch_thread_self(), ##args); \
>> + (void *)(long)_dispatch_thread_self(), ##args); \
>> } \
>> })
>
> Possibly we should cast to uintptr_t? Or maybe we should do the cast in _dispatch_thread_self() so that, internal to GCD, thread IDs are always treated as pointers.
>
> Robert
>
>>
>> -
>> uint64_t _dispatch_get_nanoseconds(void);
>>
>> #ifndef DISPATCH_NO_LEGACY
>>
>>
>> On 6 nov 2009, at 19.52, Paolo Bonzini wrote:
>>
>>> On 11/06/2009 04:01 PM, Joakim Johansson wrote:
>>>> 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.
>>> There is already a cast:
>>>> (void *)_dispatch_thread_self(), ##args); \
>>> so the _dispatch_debug definition should be okay for Solaris too. If you have a warning, change it to (void*)(long)_dispatch_thread_self().
>>> Paolo
>>> _______________________________________________
>>> libdispatch-dev mailing list
>>> libdispatch-dev at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
>>
>> _______________________________________________
>> libdispatch-dev mailing list
>> libdispatch-dev at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
More information about the libdispatch-dev
mailing list