Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
500d7724
Commit
500d7724
authored
Apr 14, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Retrieve the Unix thread affinity for the initial thread.
parent
4fd8bab9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
thread.c
server/thread.c
+23
-2
No files found.
server/thread.c
View file @
500d7724
...
@@ -190,7 +190,6 @@ static inline void init_thread_structure( struct thread *thread )
...
@@ -190,7 +190,6 @@ static inline void init_thread_structure( struct thread *thread )
thread
->
state
=
RUNNING
;
thread
->
state
=
RUNNING
;
thread
->
exit_code
=
0
;
thread
->
exit_code
=
0
;
thread
->
priority
=
0
;
thread
->
priority
=
0
;
thread
->
affinity
=
~
0
;
thread
->
suspend
=
0
;
thread
->
suspend
=
0
;
thread
->
desktop_users
=
0
;
thread
->
desktop_users
=
0
;
thread
->
token
=
NULL
;
thread
->
token
=
NULL
;
...
@@ -432,6 +431,24 @@ int set_thread_affinity( struct thread *thread, affinity_t affinity )
...
@@ -432,6 +431,24 @@ int set_thread_affinity( struct thread *thread, affinity_t affinity )
return
ret
;
return
ret
;
}
}
affinity_t
get_thread_affinity
(
struct
thread
*
thread
)
{
affinity_t
mask
=
0
;
#ifdef HAVE_SCHED_SETAFFINITY
if
(
thread
->
unix_tid
!=
-
1
)
{
cpu_set_t
set
;
unsigned
int
i
;
if
(
!
sched_getaffinity
(
thread
->
unix_tid
,
sizeof
(
set
),
&
set
))
for
(
i
=
0
;
i
<
8
*
sizeof
(
mask
);
i
++
)
if
(
CPU_ISSET
(
i
,
&
set
))
mask
|=
1
<<
i
;
}
#endif
if
(
!
mask
)
mask
=
~
0
;
return
mask
;
}
#define THREAD_PRIORITY_REALTIME_HIGHEST 6
#define THREAD_PRIORITY_REALTIME_HIGHEST 6
#define THREAD_PRIORITY_REALTIME_LOWEST -7
#define THREAD_PRIORITY_REALTIME_LOWEST -7
...
@@ -1157,6 +1174,10 @@ DECL_HANDLER(init_thread)
...
@@ -1157,6 +1174,10 @@ DECL_HANDLER(init_thread)
process
->
peb
=
req
->
entry
;
process
->
peb
=
req
->
entry
;
process
->
cpu
=
req
->
cpu
;
process
->
cpu
=
req
->
cpu
;
reply
->
info_size
=
init_process
(
current
);
reply
->
info_size
=
init_process
(
current
);
if
(
!
process
->
parent
)
process
->
affinity
=
current
->
affinity
=
get_thread_affinity
(
current
);
else
set_thread_affinity
(
current
,
current
->
affinity
);
}
}
else
else
{
{
...
@@ -1169,9 +1190,9 @@ DECL_HANDLER(init_thread)
...
@@ -1169,9 +1190,9 @@ DECL_HANDLER(init_thread)
process
->
unix_pid
=
-
1
;
/* can happen with linuxthreads */
process
->
unix_pid
=
-
1
;
/* can happen with linuxthreads */
if
(
current
->
suspend
+
process
->
suspend
>
0
)
stop_thread
(
current
);
if
(
current
->
suspend
+
process
->
suspend
>
0
)
stop_thread
(
current
);
generate_debug_event
(
current
,
CREATE_THREAD_DEBUG_EVENT
,
&
req
->
entry
);
generate_debug_event
(
current
,
CREATE_THREAD_DEBUG_EVENT
,
&
req
->
entry
);
set_thread_affinity
(
current
,
current
->
affinity
);
}
}
debug_level
=
max
(
debug_level
,
req
->
debug_level
);
debug_level
=
max
(
debug_level
,
req
->
debug_level
);
set_thread_affinity
(
current
,
current
->
affinity
);
reply
->
pid
=
get_process_id
(
process
);
reply
->
pid
=
get_process_id
(
process
);
reply
->
tid
=
get_thread_id
(
current
);
reply
->
tid
=
get_thread_id
(
current
);
...
...
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