Re: [PATCH 2/2] kernel32/tests: Add test for 'all processors' flag on Vista and newer (try 3).
On 20 February 2010 00:19, Erich Hoover <ehoover(a)mines.edu> wrote:
+ /* NOTE: Pre-Vista does not recognize the "all processors" flag (-1) */ + thread_affinity = -1; ~0UL probably makes more sense than -1 for an unsigned variable.
- const ULONG_PTR *paff = data; + ULONG_PTR req_aff = *(ULONG_PTR *)data; You shouldn't cast const away.
Is "-1" special, or does the call just always mask the requested mask with the available processors on Vista and above?
On Fri, Feb 19, 2010 at 5:08 PM, Henri Verbeet <hverbeet(a)gmail.com> wrote:
On 20 February 2010 00:19, Erich Hoover <ehoover(a)mines.edu> wrote:
+ /* NOTE: Pre-Vista does not recognize the "all processors" flag (-1) */ + thread_affinity = -1; ~0UL probably makes more sense than -1 for an unsigned variable.
- const ULONG_PTR *paff = data; + ULONG_PTR req_aff = *(ULONG_PTR *)data; You shouldn't cast const away.
Is "-1" special, or does the call just always mask the requested mask with the available processors on Vista and above?
"-1" is special, I was honestly very surprised by this as it seems like a dirty trick*. You can see that this is the case from the test for "other masks," which still errors out on Vista and Window 7 (ie. the test succeeds): --- ok(SetThreadAffinityMask(curthread,processMask+1)==0, "SetThreadAffinityMask passed for an illegal processor\n"); --- Erich Hoover ehoover(a)mines.edu * That there's no good reason to do this except to artificially make apps run better on Vista and Windows 7.
participants (2)
-
Erich Hoover -
Henri Verbeet