Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
2f3fa859
Commit
2f3fa859
authored
Feb 02, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Allow changing a thread affinity before it is initialized.
parent
b2a8cca6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
thread.c
server/thread.c
+14
-14
thread.h
server/thread.h
+1
-1
No files found.
server/thread.c
View file @
2f3fa859
...
...
@@ -407,13 +407,9 @@ struct thread *get_thread_from_pid( int pid )
return
NULL
;
}
void
set_thread_affinity
(
struct
thread
*
thread
,
affinity_t
affinity
)
int
set_thread_affinity
(
struct
thread
*
thread
,
affinity_t
affinity
)
{
if
((
affinity
&
thread
->
process
->
affinity
)
!=
affinity
)
{
set_error
(
STATUS_INVALID_PARAMETER
);
return
;
}
int
ret
=
0
;
#ifdef HAVE_SCHED_SETAFFINITY
if
(
thread
->
unix_tid
!=
-
1
)
{
...
...
@@ -425,15 +421,11 @@ void set_thread_affinity( struct thread *thread, affinity_t affinity )
for
(
i
=
0
,
mask
=
1
;
mask
;
i
++
,
mask
<<=
1
)
if
(
affinity
&
mask
)
CPU_SET
(
i
,
&
set
);
if
(
!
sched_setaffinity
(
thread
->
unix_tid
,
sizeof
(
set
),
&
set
))
thread
->
affinity
=
affinity
;
else
file_set_error
();
ret
=
sched_setaffinity
(
thread
->
unix_tid
,
sizeof
(
set
),
&
set
);
}
else
set_error
(
STATUS_ACCESS_DENIED
);
#else
thread
->
affinity
=
affinity
;
#endif
if
(
!
ret
)
thread
->
affinity
=
affinity
;
return
ret
;
}
#define THREAD_PRIORITY_REALTIME_HIGHEST 6
...
...
@@ -460,7 +452,14 @@ static void set_thread_info( struct thread *thread,
set_error
(
STATUS_INVALID_PARAMETER
);
}
if
(
req
->
mask
&
SET_THREAD_INFO_AFFINITY
)
set_thread_affinity
(
thread
,
req
->
affinity
);
{
if
((
req
->
affinity
&
thread
->
process
->
affinity
)
!=
req
->
affinity
)
set_error
(
STATUS_INVALID_PARAMETER
);
else
if
(
thread
->
state
==
TERMINATED
)
set_error
(
STATUS_ACCESS_DENIED
);
else
if
(
set_thread_affinity
(
thread
,
req
->
affinity
))
file_set_error
();
}
if
(
req
->
mask
&
SET_THREAD_INFO_TOKEN
)
security_set_thread_token
(
thread
,
req
->
token
);
}
...
...
@@ -1158,6 +1157,7 @@ DECL_HANDLER(init_thread)
generate_debug_event
(
current
,
CREATE_THREAD_DEBUG_EVENT
,
&
req
->
entry
);
}
debug_level
=
max
(
debug_level
,
req
->
debug_level
);
set_thread_affinity
(
current
,
current
->
affinity
);
reply
->
pid
=
get_process_id
(
process
);
reply
->
tid
=
get_thread_id
(
current
);
...
...
server/thread.h
View file @
2f3fa859
...
...
@@ -118,7 +118,7 @@ extern int thread_add_inflight_fd( struct thread *thread, int client, int server
extern
int
thread_get_inflight_fd
(
struct
thread
*
thread
,
int
client
);
extern
struct
thread_snapshot
*
thread_snap
(
int
*
count
);
extern
struct
token
*
thread_get_impersonation_token
(
struct
thread
*
thread
);
extern
void
set_thread_affinity
(
struct
thread
*
thread
,
affinity_t
affinity
);
extern
int
set_thread_affinity
(
struct
thread
*
thread
,
affinity_t
affinity
);
/* ptrace functions */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment