Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
2f3fa859
Commit
2f3fa859
authored
15 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
server: Allow changing a thread affinity before it is initialized.
parent
b2a8cca6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/thread.c
+14
-14
14 additions, 14 deletions
server/thread.c
server/thread.h
+1
-1
1 addition, 1 deletion
server/thread.h
with
15 additions
and
15 deletions
server/thread.c
+
14
−
14
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
);
...
...
This diff is collapsed.
Click to expand it.
server/thread.h
+
1
−
1
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 */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment