[libdispatch-dev] libdispatch on VS 2008 and VS 2010 64bit

Mark Heily mark at heily.com
Tue Jun 14 21:33:26 PDT 2011

On 06/12/2011 10:28 PM, DrPizza wrote:
> IMHO we should change anything that might reasonably be used for pointer-size
> values. This has some API-level consequences; I think it would be good if we
> changed:
> unsigned long dispatch_source_get_data(dispatch_source_t source);
> void dispatch_source_merge_data(dispatch_source_t source, unsigned long value);
> This change in turn has consequences in a few places within the codebase,
> where longs and related types need to be changed to intptr_ts.
> It would be desirable in many regards to change the mask similarly, in:
> unsigned long dispatch_source_get_mask(dispatch_source_t source);
> dispatch_source_t dispatch_source_create(dispatch_source_type_t type,
>                                           uintptr_t handle,
>                                           unsigned long mask,
>                                           dispatch_queue_t queue);
> However, this is a problem, because struct kevent uses an int32 for the mask
> (libdispatch stores the mask in the fflags member, which has type u_int). So,
> for that matter, does kevent64_s. Two thoughts occur. One, switch to
> kevent64_s and store the mask in ext[0]. Two, stop using long for the mask
> value, so that the interface becomes honest. We can't use it as a long, so
> stop pretending that we can.

Hi Peter,

I don't think that the 'mask' parameter can reasonably be used for 
pointer-size values. According to the documentation, the possible values of 
'mask' are well-defined and fit within a 32-bit integer type [1]. There is 
one  exception: DISPATCH_SOURCE_TYPE_DATA_OR supports arbitrary values for 
the 'mask' parameter.

It should be sufficient to document in the manpage that the 'mask' 
parameter is limited to the lower 32 bits for the 
DISPATCH_SOURCE_TYPE_DATA_OR source type. If anyone wants to use more than 
32 bitflags in a single bitmask, then they are probably doing something wrong :)

You've raised some other excellent points related to LP64 v.s. LLP64, and 
I'll respond in a separate message.


  - Mark



More information about the libdispatch-dev mailing list