mirror of
https://github.com/wine-mirror/wine
synced 2024-07-08 20:06:18 +00:00
server: Use kernel support for thread affinity when available.
This commit is contained in:
parent
24036fe13a
commit
474b2e4bfb
1
configure
vendored
1
configure
vendored
|
@ -12127,6 +12127,7 @@ for ac_func in \
|
||||||
pwrite \
|
pwrite \
|
||||||
readdir \
|
readdir \
|
||||||
readlink \
|
readlink \
|
||||||
|
sched_setaffinity \
|
||||||
sched_yield \
|
sched_yield \
|
||||||
select \
|
select \
|
||||||
setproctitle \
|
setproctitle \
|
||||||
|
|
|
@ -1692,6 +1692,7 @@ AC_CHECK_FUNCS(\
|
||||||
pwrite \
|
pwrite \
|
||||||
readdir \
|
readdir \
|
||||||
readlink \
|
readlink \
|
||||||
|
sched_setaffinity \
|
||||||
sched_yield \
|
sched_yield \
|
||||||
select \
|
select \
|
||||||
setproctitle \
|
setproctitle \
|
||||||
|
|
|
@ -645,6 +645,9 @@
|
||||||
/* Define to 1 if you have the <sched.h> header file. */
|
/* Define to 1 if you have the <sched.h> header file. */
|
||||||
#undef HAVE_SCHED_H
|
#undef HAVE_SCHED_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sched_setaffinity' function. */
|
||||||
|
#undef HAVE_SCHED_SETAFFINITY
|
||||||
|
|
||||||
/* Define to 1 if you have the `sched_yield' function. */
|
/* Define to 1 if you have the `sched_yield' function. */
|
||||||
#undef HAVE_SCHED_YIELD
|
#undef HAVE_SCHED_YIELD
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,9 @@
|
||||||
#ifdef HAVE_POLL_H
|
#ifdef HAVE_POLL_H
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_SCHED_H
|
||||||
|
#include <sched.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ntstatus.h"
|
#include "ntstatus.h"
|
||||||
#define WIN32_NO_STATUS
|
#define WIN32_NO_STATUS
|
||||||
|
@ -406,7 +409,26 @@ struct thread *get_thread_from_pid( int pid )
|
||||||
|
|
||||||
void set_thread_affinity( struct thread *thread, affinity_t affinity )
|
void set_thread_affinity( struct thread *thread, affinity_t affinity )
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_SCHED_SETAFFINITY
|
||||||
|
if (thread->unix_pid != -1)
|
||||||
|
{
|
||||||
|
cpu_set_t set;
|
||||||
|
int i;
|
||||||
|
affinity_t mask;
|
||||||
|
|
||||||
|
CPU_ZERO( &set );
|
||||||
|
for (i = 0, mask = 1; mask; i++, mask <<= 1)
|
||||||
|
if (affinity & mask) CPU_SET( i, &set );
|
||||||
|
|
||||||
|
if (!sched_setaffinity( thread->unix_pid, sizeof(set), &set ))
|
||||||
|
thread->affinity = affinity;
|
||||||
|
else
|
||||||
|
file_set_error();
|
||||||
|
}
|
||||||
|
else set_error( STATUS_ACCESS_DENIED );
|
||||||
|
#else
|
||||||
thread->affinity = affinity;
|
thread->affinity = affinity;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define THREAD_PRIORITY_REALTIME_HIGHEST 6
|
#define THREAD_PRIORITY_REALTIME_HIGHEST 6
|
||||||
|
|
Loading…
Reference in New Issue
Block a user