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
f59551c2
Commit
f59551c2
authored
Jul 14, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
Jul 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vcomp: Implement _vcomp_set_num_threads and omp_get_thread_num.
parent
800ca050
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
4 deletions
+72
-4
main.c
dlls/vcomp/main.c
+72
-4
No files found.
dlls/vcomp/main.c
View file @
f59551c2
...
...
@@ -29,10 +29,54 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
vcomp
);
static
DWORD
vcomp_context_tls
=
TLS_OUT_OF_INDEXES
;
static
int
vcomp_max_threads
;
static
int
vcomp_num_threads
;
static
BOOL
vcomp_nested_fork
=
FALSE
;
struct
vcomp_thread_data
{
int
thread_num
;
int
fork_threads
;
};
static
inline
struct
vcomp_thread_data
*
vcomp_get_thread_data
(
void
)
{
return
(
struct
vcomp_thread_data
*
)
TlsGetValue
(
vcomp_context_tls
);
}
static
inline
void
vcomp_set_thread_data
(
struct
vcomp_thread_data
*
thread_data
)
{
TlsSetValue
(
vcomp_context_tls
,
thread_data
);
}
static
struct
vcomp_thread_data
*
vcomp_init_thread_data
(
void
)
{
struct
vcomp_thread_data
*
thread_data
=
vcomp_get_thread_data
();
if
(
thread_data
)
return
thread_data
;
if
(
!
(
thread_data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
thread_data
))))
{
ERR
(
"could not create thread data
\n
"
);
ExitProcess
(
1
);
}
thread_data
->
thread_num
=
0
;
thread_data
->
fork_threads
=
0
;
vcomp_set_thread_data
(
thread_data
);
return
thread_data
;
}
static
void
vcomp_free_thread_data
(
void
)
{
struct
vcomp_thread_data
*
thread_data
=
vcomp_get_thread_data
();
if
(
!
thread_data
)
return
;
HeapFree
(
GetProcessHeap
(),
0
,
thread_data
);
vcomp_set_thread_data
(
NULL
);
}
int
CDECL
omp_get_dynamic
(
void
)
{
TRACE
(
"stub
\n
"
);
...
...
@@ -65,8 +109,8 @@ int CDECL omp_get_num_threads(void)
int
CDECL
omp_get_thread_num
(
void
)
{
TRACE
(
"
stub
\n
"
);
return
0
;
TRACE
(
"
()
\n
"
);
return
vcomp_init_thread_data
()
->
thread_num
;
}
/* Time in seconds since "some time in the past" */
...
...
@@ -100,7 +144,9 @@ void CDECL _vcomp_barrier(void)
void
CDECL
_vcomp_set_num_threads
(
int
num_threads
)
{
TRACE
(
"(%d): stub
\n
"
,
num_threads
);
TRACE
(
"(%d)
\n
"
,
num_threads
);
if
(
num_threads
>=
1
)
vcomp_init_thread_data
()
->
fork_threads
=
num_threads
;
}
int
CDECL
_vcomp_single_begin
(
int
flags
)
...
...
@@ -126,13 +172,35 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
case
DLL_PROCESS_ATTACH
:
{
SYSTEM_INFO
sysinfo
;
DisableThreadLibraryCalls
(
instance
);
if
((
vcomp_context_tls
=
TlsAlloc
())
==
TLS_OUT_OF_INDEXES
)
{
ERR
(
"Failed to allocate TLS index
\n
"
);
return
FALSE
;
}
GetSystemInfo
(
&
sysinfo
);
vcomp_max_threads
=
sysinfo
.
dwNumberOfProcessors
;
vcomp_num_threads
=
sysinfo
.
dwNumberOfProcessors
;
break
;
}
case
DLL_PROCESS_DETACH
:
{
if
(
reserved
)
break
;
if
(
vcomp_context_tls
!=
TLS_OUT_OF_INDEXES
)
{
vcomp_free_thread_data
();
TlsFree
(
vcomp_context_tls
);
}
break
;
}
case
DLL_THREAD_DETACH
:
{
vcomp_free_thread_data
();
break
;
}
}
return
TRUE
;
...
...
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