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
4523a54c
Commit
4523a54c
authored
Jul 05, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
Jul 06, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Implement TpAllocWait and TpReleaseWait.
parent
8b566b1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
1 deletion
+68
-1
ntdll.spec
dlls/ntdll/ntdll.spec
+2
-0
threadpool.c
dlls/ntdll/threadpool.c
+66
-1
No files found.
dlls/ntdll/ntdll.spec
View file @
4523a54c
...
...
@@ -973,6 +973,7 @@
@ stdcall TpAllocCleanupGroup(ptr)
@ stdcall TpAllocPool(ptr ptr)
@ stdcall TpAllocTimer(ptr ptr ptr ptr)
@ stdcall TpAllocWait(ptr ptr ptr ptr)
@ stdcall TpAllocWork(ptr ptr ptr ptr)
@ stdcall TpCallbackLeaveCriticalSectionOnCompletion(ptr ptr)
@ stdcall TpCallbackMayRunLong(ptr)
...
...
@@ -987,6 +988,7 @@
@ stdcall TpReleaseCleanupGroupMembers(ptr long ptr)
@ stdcall TpReleasePool(ptr)
@ stdcall TpReleaseTimer(ptr)
@ stdcall TpReleaseWait(ptr)
@ stdcall TpReleaseWork(ptr)
@ stdcall TpSetPoolMaxThreads(ptr long)
@ stdcall TpSetPoolMinThreads(ptr long)
...
...
dlls/ntdll/threadpool.c
View file @
4523a54c
...
...
@@ -159,7 +159,8 @@ enum threadpool_objtype
{
TP_OBJECT_TYPE_SIMPLE
,
TP_OBJECT_TYPE_WORK
,
TP_OBJECT_TYPE_TIMER
TP_OBJECT_TYPE_TIMER
,
TP_OBJECT_TYPE_WAIT
};
/* internal threadpool object representation */
...
...
@@ -209,6 +210,10 @@ struct threadpool_object
LONG
period
;
LONG
window_length
;
}
timer
;
struct
{
PTP_WAIT_CALLBACK
callback
;
}
wait
;
}
u
;
};
...
...
@@ -286,6 +291,13 @@ static inline struct threadpool_object *impl_from_TP_TIMER( TP_TIMER *timer )
return
object
;
}
static
inline
struct
threadpool_object
*
impl_from_TP_WAIT
(
TP_WAIT
*
wait
)
{
struct
threadpool_object
*
object
=
(
struct
threadpool_object
*
)
wait
;
assert
(
object
->
type
==
TP_OBJECT_TYPE_WAIT
);
return
object
;
}
static
inline
struct
threadpool_group
*
impl_from_TP_CLEANUP_GROUP
(
TP_CLEANUP_GROUP
*
group
)
{
return
(
struct
threadpool_group
*
)
group
;
...
...
@@ -1907,6 +1919,15 @@ static void CALLBACK threadpool_worker_proc( void *param )
break
;
}
case
TP_OBJECT_TYPE_WAIT
:
{
TRACE
(
"executing wait callback %p(%p, %p, %p, %u)
\n
"
,
object
->
u
.
wait
.
callback
,
callback_instance
,
object
->
userdata
,
object
,
WAIT_OBJECT_0
);
object
->
u
.
wait
.
callback
(
callback_instance
,
object
->
userdata
,
(
TP_WAIT
*
)
object
,
WAIT_OBJECT_0
);
TRACE
(
"callback %p returned
\n
"
,
object
->
u
.
wait
.
callback
);
break
;
}
default:
assert
(
0
);
break
;
...
...
@@ -2052,6 +2073,37 @@ NTSTATUS WINAPI TpAllocTimer( TP_TIMER **out, PTP_TIMER_CALLBACK callback, PVOID
}
/***********************************************************************
* TpAllocWait (NTDLL.@)
*/
NTSTATUS
WINAPI
TpAllocWait
(
TP_WAIT
**
out
,
PTP_WAIT_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_WAIT
;
object
->
u
.
wait
.
callback
=
callback
;
tp_object_initialize
(
object
,
pool
,
userdata
,
environment
);
*
out
=
(
TP_WAIT
*
)
object
;
return
STATUS_SUCCESS
;
}
/***********************************************************************
* TpAllocWork (NTDLL.@)
*/
NTSTATUS
WINAPI
TpAllocWork
(
TP_WORK
**
out
,
PTP_WORK_CALLBACK
callback
,
PVOID
userdata
,
...
...
@@ -2356,6 +2408,19 @@ VOID WINAPI TpReleaseTimer( TP_TIMER *timer )
}
/***********************************************************************
* TpReleaseWait (NTDLL.@)
*/
VOID
WINAPI
TpReleaseWait
(
TP_WAIT
*
wait
)
{
struct
threadpool_object
*
this
=
impl_from_TP_WAIT
(
wait
);
TRACE
(
"%p
\n
"
,
wait
);
tp_object_shutdown
(
this
);
tp_object_release
(
this
);
}
/***********************************************************************
* TpReleaseWork (NTDLL.@)
*/
VOID
WINAPI
TpReleaseWork
(
TP_WORK
*
work
)
...
...
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