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
e4c38f6b
Commit
e4c38f6b
authored
Jul 01, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
Jul 01, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Implement threadpool work item functions.
parent
3606b471
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
1 deletion
+96
-1
ntdll.spec
dlls/ntdll/ntdll.spec
+4
-0
threadpool.c
dlls/ntdll/threadpool.c
+92
-1
No files found.
dlls/ntdll/ntdll.spec
View file @
e4c38f6b
...
...
@@ -972,12 +972,16 @@
@ stdcall RtlxUnicodeStringToOemSize(ptr) RtlUnicodeStringToOemSize
@ stdcall TpAllocCleanupGroup(ptr)
@ stdcall TpAllocPool(ptr ptr)
@ stdcall TpAllocWork(ptr ptr ptr ptr)
@ stdcall TpPostWork(ptr)
@ stdcall TpReleaseCleanupGroup(ptr)
@ stdcall TpReleaseCleanupGroupMembers(ptr long ptr)
@ stdcall TpReleasePool(ptr)
@ stdcall TpReleaseWork(ptr)
@ stdcall TpSetPoolMaxThreads(ptr long)
@ stdcall TpSetPoolMinThreads(ptr long)
@ stdcall TpSimpleTryPost(ptr ptr ptr)
@ stdcall TpWaitForWork(ptr long)
@ stdcall -ret64 VerSetConditionMask(int64 long long)
@ stdcall WinSqmIsOptedIn()
@ stdcall ZwAcceptConnectPort(ptr long ptr long long ptr) NtAcceptConnectPort
...
...
dlls/ntdll/threadpool.c
View file @
e4c38f6b
...
...
@@ -157,7 +157,8 @@ struct threadpool
enum
threadpool_objtype
{
TP_OBJECT_TYPE_SIMPLE
TP_OBJECT_TYPE_SIMPLE
,
TP_OBJECT_TYPE_WORK
};
/* internal threadpool object representation */
...
...
@@ -185,6 +186,10 @@ struct threadpool_object
{
PTP_SIMPLE_CALLBACK
callback
;
}
simple
;
struct
{
PTP_WORK_CALLBACK
callback
;
}
work
;
}
u
;
};
...
...
@@ -203,6 +208,13 @@ static inline struct threadpool *impl_from_TP_POOL( TP_POOL *pool )
return
(
struct
threadpool
*
)
pool
;
}
static
inline
struct
threadpool_object
*
impl_from_TP_WORK
(
TP_WORK
*
work
)
{
struct
threadpool_object
*
object
=
(
struct
threadpool_object
*
)
work
;
assert
(
object
->
type
==
TP_OBJECT_TYPE_WORK
);
return
object
;
}
static
inline
struct
threadpool_group
*
impl_from_TP_CLEANUP_GROUP
(
TP_CLEANUP_GROUP
*
group
)
{
return
(
struct
threadpool_group
*
)
group
;
...
...
@@ -1579,6 +1591,15 @@ static void CALLBACK threadpool_worker_proc( void *param )
break
;
}
case
TP_OBJECT_TYPE_WORK
:
{
TRACE
(
"executing work callback %p(NULL, %p, %p)
\n
"
,
object
->
u
.
work
.
callback
,
object
->
userdata
,
object
);
object
->
u
.
work
.
callback
(
NULL
,
object
->
userdata
,
(
TP_WORK
*
)
object
);
TRACE
(
"callback %p returned
\n
"
,
object
->
u
.
work
.
callback
);
break
;
}
default:
assert
(
0
);
break
;
...
...
@@ -1641,6 +1662,49 @@ NTSTATUS WINAPI TpAllocPool( TP_POOL **out, PVOID reserved )
}
/***********************************************************************
* TpAllocWork (NTDLL.@)
*/
NTSTATUS
WINAPI
TpAllocWork
(
TP_WORK
**
out
,
PTP_WORK_CALLBACK
callback
,
PVOID
userdata
,
TP_CALLBACK_ENVIRON
*
environment
)
{
struct
threadpool_object
*
object
;
struct
threadpool
*
pool
;
NTSTATUS
status
;
TRACE
(
"%p %p %p %p
\n
"
,
out
,
callback
,
userdata
,
environment
);
object
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
*
object
)
);
if
(
!
object
)
return
STATUS_NO_MEMORY
;
status
=
tp_threadpool_lock
(
&
pool
,
environment
);
if
(
status
)
{
RtlFreeHeap
(
GetProcessHeap
(),
0
,
object
);
return
status
;
}
object
->
type
=
TP_OBJECT_TYPE_WORK
;
object
->
u
.
work
.
callback
=
callback
;
tp_object_initialize
(
object
,
pool
,
userdata
,
environment
);
*
out
=
(
TP_WORK
*
)
object
;
return
STATUS_SUCCESS
;
}
/***********************************************************************
* TpPostWork (NTDLL.@)
*/
VOID
WINAPI
TpPostWork
(
TP_WORK
*
work
)
{
struct
threadpool_object
*
this
=
impl_from_TP_WORK
(
work
);
TRACE
(
"%p
\n
"
,
work
);
tp_object_submit
(
this
);
}
/***********************************************************************
* TpReleaseCleanupGroup (NTDLL.@)
*/
VOID
WINAPI
TpReleaseCleanupGroup
(
TP_CLEANUP_GROUP
*
group
)
...
...
@@ -1728,6 +1792,19 @@ VOID WINAPI TpReleasePool( TP_POOL *pool )
}
/***********************************************************************
* TpReleaseWork (NTDLL.@)
*/
VOID
WINAPI
TpReleaseWork
(
TP_WORK
*
work
)
{
struct
threadpool_object
*
this
=
impl_from_TP_WORK
(
work
);
TRACE
(
"%p
\n
"
,
work
);
tp_object_shutdown
(
this
);
tp_object_release
(
this
);
}
/***********************************************************************
* TpSetPoolMaxThreads (NTDLL.@)
*/
VOID
WINAPI
TpSetPoolMaxThreads
(
TP_POOL
*
pool
,
DWORD
maximum
)
...
...
@@ -1806,3 +1883,17 @@ NTSTATUS WINAPI TpSimpleTryPost( PTP_SIMPLE_CALLBACK callback, PVOID userdata,
return
STATUS_SUCCESS
;
}
/***********************************************************************
* TpWaitForWork (NTDLL.@)
*/
VOID
WINAPI
TpWaitForWork
(
TP_WORK
*
work
,
BOOL
cancel_pending
)
{
struct
threadpool_object
*
this
=
impl_from_TP_WORK
(
work
);
TRACE
(
"%p %u
\n
"
,
work
,
cancel_pending
);
if
(
cancel_pending
)
tp_object_cancel
(
this
);
tp_object_wait
(
this
);
}
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