server: A thread's affinity is restricted to the process affinity.
This commit is contained in:
parent
6614323807
commit
bfb4578356
|
@ -947,6 +947,11 @@ static void test_affinity(void)
|
|||
status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
|
||||
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
||||
ok( tbi.AffinityMask == 2, "Unexpected thread affinity\n" );
|
||||
/* The thread affinity is restricted to the process affinity */
|
||||
thread_affinity = 1;
|
||||
status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) );
|
||||
ok( status == STATUS_INVALID_PARAMETER,
|
||||
"Expected STATUS_INVALID_PARAMETER, got %08x\n", status);
|
||||
|
||||
proc_affinity = (1 << si.dwNumberOfProcessors) - 1;
|
||||
status = pNtSetInformationProcess( GetCurrentProcess(), ProcessAffinityMask, &proc_affinity, sizeof(proc_affinity) );
|
||||
|
|
|
@ -409,6 +409,11 @@ struct thread *get_thread_from_pid( int pid )
|
|||
|
||||
void set_thread_affinity( struct thread *thread, affinity_t affinity )
|
||||
{
|
||||
if ((affinity & thread->process->affinity) != affinity)
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return;
|
||||
}
|
||||
#ifdef HAVE_SCHED_SETAFFINITY
|
||||
if (thread->unix_pid != -1)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue