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
a18bdf13
Commit
a18bdf13
authored
19 years ago
by
Robert Shearman
Committed by
Alexandre Julliard
19 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ntdll: Very crude implementation of RtlQueueWorkItem.
parent
44cb832f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
dlls/ntdll/Makefile.in
+1
-0
1 addition, 0 deletions
dlls/ntdll/Makefile.in
dlls/ntdll/ntdll.spec
+1
-1
1 addition, 1 deletion
dlls/ntdll/ntdll.spec
dlls/ntdll/threadpool.c
+107
-0
107 additions, 0 deletions
dlls/ntdll/threadpool.c
include/winternl.h
+2
-0
2 additions, 0 deletions
include/winternl.h
with
111 additions
and
1 deletion
dlls/ntdll/Makefile.in
+
1
−
0
View file @
a18bdf13
...
...
@@ -47,6 +47,7 @@ C_SRCS = \
tape.c
\
version.c
\
thread.c
\
threadpool.c
\
time.c
\
virtual.c
\
wcstring.c
...
...
This diff is collapsed.
Click to expand it.
dlls/ntdll/ntdll.spec
+
1
−
1
View file @
a18bdf13
...
...
@@ -781,7 +781,7 @@
@ stub RtlQueryTagHeap
@ stdcall RtlQueryTimeZoneInformation(ptr)
@ stub RtlQueueApcWow64Thread
@ st
ub
RtlQueueWorkItem
@ st
dcall
RtlQueueWorkItem
(ptr ptr long)
@ stdcall -register RtlRaiseException(ptr)
@ stdcall RtlRaiseStatus(long)
@ stdcall RtlRandom(ptr)
...
...
This diff is collapsed.
Click to expand it.
dlls/ntdll/threadpool.c
0 → 100644
+
107
−
0
View file @
a18bdf13
/*
* Thread pooling
*
* Copyright (c) 2006 Robert Shearman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include
<stdarg.h>
#define NONAMELESSUNION
#include
"ntstatus.h"
#define WIN32_NO_STATUS
#include
"winternl.h"
#include
"wine/debug.h"
#include
"ntdll_misc.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
threadpool
);
struct
work_item
{
PRTL_WORK_ITEM_ROUTINE
function
;
PVOID
context
;
};
static
void
WINAPI
worker_thread_proc
(
void
*
param
)
{
struct
work_item
*
work_item_ptr
=
(
struct
work_item
*
)
param
;
struct
work_item
work_item
;
/* free the work item memory sooner to reduce memory usage */
work_item
=
*
work_item_ptr
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
work_item_ptr
);
TRACE
(
"executing %p(%p)
\n
"
,
work_item
.
function
,
work_item
.
context
);
/* do the work */
work_item
.
function
(
work_item
.
context
);
RtlExitUserThread
(
0
);
/* never reached */
}
/***********************************************************************
* RtlQueueWorkItem (NTDLL.@)
*
* Queues a work item into a thread in the thread pool.
*
* PARAMS
* Function [I] Work function to execute.
* Context [I] Context to pass to the work function when it is executed.
* Flags [I] Flags. See notes.
*
* RETURNS
* Success: STATUS_SUCCESS.
* Failure: Any NTSTATUS code.
*
* NOTES
* Flags can be one or more of the following:
*|WT_EXECUTEDEFAULT - Executes the work item in a non-I/O worker thread.
*|WT_EXECUTEINIOTHREAD - Executes the work item in an I/O worker thread.
*|WT_EXECUTEINPERSISTENTTHREAD - Executes the work item in a thread that is persistent.
*|WT_EXECUTELONGFUNCTION - Hints that the execution can take a long time.
*|WT_TRANSFER_IMPERSONATION - Executes the function with the current access token.
*/
NTSTATUS
WINAPI
RtlQueueWorkItem
(
PRTL_WORK_ITEM_ROUTINE
Function
,
PVOID
Context
,
ULONG
Flags
)
{
HANDLE
thread
;
NTSTATUS
status
;
struct
work_item
*
work_item
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
struct
work_item
));
if
(
!
work_item
)
return
STATUS_NO_MEMORY
;
work_item
->
function
=
Function
;
work_item
->
context
=
Context
;
if
(
Flags
!=
WT_EXECUTEDEFAULT
)
FIXME
(
"Flags 0x%lx not supported
\n
"
,
Flags
);
/* FIXME: very crude implementation that doesn't support pooling at all */
status
=
RtlCreateUserThread
(
GetCurrentProcess
(),
NULL
,
FALSE
,
NULL
,
0
,
0
,
worker_thread_proc
,
work_item
,
&
thread
,
NULL
);
if
(
status
!=
STATUS_SUCCESS
)
{
RtlFreeHeap
(
GetProcessHeap
(),
0
,
work_item
);
return
status
;
}
NtClose
(
thread
);
return
STATUS_SUCCESS
;
}
This diff is collapsed.
Click to expand it.
include/winternl.h
+
2
−
0
View file @
a18bdf13
...
...
@@ -1429,6 +1429,7 @@ typedef struct _RTL_HANDLE_TABLE
typedef
void
(
CALLBACK
*
PNTAPCFUNC
)(
ULONG_PTR
,
ULONG_PTR
,
ULONG_PTR
);
/* FIXME: not the right name */
typedef
void
(
CALLBACK
*
PRTL_THREAD_START_ROUTINE
)(
LPVOID
);
/* FIXME: not the right name */
typedef
DWORD
(
CALLBACK
*
PRTL_WORK_ITEM_ROUTINE
)(
LPVOID
);
/* FIXME: not the right name */
/* DbgPrintEx default levels */
...
...
@@ -2129,6 +2130,7 @@ NTSTATUS WINAPI RtlQueryInformationAcl(PACL,LPVOID,DWORD,ACL_INFORMATION_CLASS)
NTSTATUS
WINAPI
RtlQueryProcessDebugInformation
(
ULONG
,
ULONG
,
PDEBUG_BUFFER
);
NTSTATUS
WINAPI
RtlQueryRegistryValues
(
ULONG
,
PCWSTR
,
PRTL_QUERY_REGISTRY_TABLE
,
PVOID
,
PVOID
);
NTSTATUS
WINAPI
RtlQueryTimeZoneInformation
(
RTL_TIME_ZONE_INFORMATION
*
);
NTSTATUS
WINAPI
RtlQueueWorkItem
(
PRTL_WORK_ITEM_ROUTINE
,
PVOID
,
ULONG
);
void
WINAPI
RtlRaiseException
(
PEXCEPTION_RECORD
);
void
WINAPI
RtlRaiseStatus
(
NTSTATUS
);
ULONG
WINAPI
RtlRandom
(
PULONG
);
...
...
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