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
217fdab7
Commit
217fdab7
authored
Jun 30, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented NtDelayExecution and make Sleep call it.
The handle count must not be 0 in NtWaitForMultipleObjects (spotted by Troy Rollo).
parent
4e1ef0c1
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
100 additions
and
31 deletions
+100
-31
file.c
dlls/ntdll/file.c
+1
-1
ntdll.spec
dlls/ntdll/ntdll.spec
+2
-2
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+2
-0
signal_i386.c
dlls/ntdll/signal_i386.c
+2
-2
signal_powerpc.c
dlls/ntdll/signal_powerpc.c
+2
-1
signal_sparc.c
dlls/ntdll/signal_sparc.c
+2
-1
sync.c
dlls/ntdll/sync.c
+72
-18
winternl.h
include/winternl.h
+3
-2
synchro.c
scheduler/synchro.c
+14
-4
No files found.
dlls/ntdll/file.c
View file @
217fdab7
...
...
@@ -1059,7 +1059,7 @@ NTSTATUS WINAPI NtLockFile( HANDLE hFile, HANDLE lock_granted_event,
/* Unix lock conflict, sleep a bit and retry */
time
.
QuadPart
=
100
*
(
ULONGLONG
)
10000
;
time
.
QuadPart
=
-
time
.
QuadPart
;
Nt
WaitForMultipleObjects
(
0
,
NULL
,
FALSE
,
FALSE
,
&
time
);
Nt
DelayExecution
(
FALSE
,
&
time
);
}
}
}
...
...
dlls/ntdll/ntdll.spec
View file @
217fdab7
...
...
@@ -95,7 +95,7 @@
@ stdcall NtCreateTimer(ptr long ptr long)
@ stub NtCreateToken
@ stdcall NtCurrentTeb()
@ st
ub NtDelayExecution
@ st
dcall NtDelayExecution(long ptr)
@ stub NtDeleteFile
@ stdcall NtDeleteKey(long)
@ stdcall NtDeleteValueKey(long ptr)
...
...
@@ -627,7 +627,7 @@
@ stub ZwCreateThread
@ stdcall ZwCreateTimer(ptr long ptr long) NtCreateTimer
@ stub ZwCreateToken
@ st
ub Zw
DelayExecution
@ st
dcall ZwDelayExecution(long ptr) Nt
DelayExecution
@ stub ZwDeleteFile
@ stdcall ZwDeleteKey(long) NtDeleteKey
@ stdcall ZwDeleteValueKey(long ptr) NtDeleteValueKey
...
...
dlls/ntdll/ntdll_misc.h
View file @
217fdab7
...
...
@@ -30,6 +30,8 @@ extern LPCSTR debugstr_us( const UNICODE_STRING *str );
extern
void
dump_ObjectAttributes
(
const
OBJECT_ATTRIBUTES
*
ObjectAttributes
);
extern
void
NTDLL_get_server_timeout
(
abs_time_t
*
when
,
const
LARGE_INTEGER
*
timeout
);
extern
NTSTATUS
NTDLL_wait_for_multiple_objects
(
UINT
count
,
const
HANDLE
*
handles
,
UINT
flags
,
const
LARGE_INTEGER
*
timeout
);
/* module handling */
extern
WINE_MODREF
*
MODULE_AllocModRef
(
HMODULE
hModule
,
LPCSTR
filename
);
...
...
dlls/ntdll/signal_i386.c
View file @
217fdab7
...
...
@@ -53,7 +53,7 @@
#include "windef.h"
#include "winternl.h"
#include "wine/library.h"
#include "ntdll_misc.h"
#include "selectors.h"
/***********************************************************************
...
...
@@ -1111,7 +1111,7 @@ static HANDLER_DEF(usr1_handler)
init_handler
(
HANDLER_CONTEXT
);
/* wait with 0 timeout, will only return once the thread is no longer suspended */
timeout
.
QuadPart
=
0
;
N
tWaitForMultipleObjects
(
0
,
NULL
,
FALSE
,
FALSE
,
&
timeout
);
N
TDLL_wait_for_multiple_objects
(
0
,
NULL
,
0
,
&
timeout
);
}
...
...
dlls/ntdll/signal_powerpc.c
View file @
217fdab7
...
...
@@ -56,6 +56,7 @@
#include "selectors.h"
#include "stackframe.h"
#include "global.h"
#include "ntdll_misc.h"
#include "miscemu.h"
#include "wine/debug.h"
...
...
@@ -585,7 +586,7 @@ static HANDLER_DEF(usr1_handler)
/* wait with 0 timeout, will only return once the thread is no longer suspended */
timeout
.
QuadPart
=
0
;
N
tWaitForMultipleObjects
(
0
,
NULL
,
FALSE
,
FALSE
,
&
timeout
);
N
TDLL_wait_for_multiple_objects
(
0
,
NULL
,
0
,
&
timeout
);
}
...
...
dlls/ntdll/signal_sparc.c
View file @
217fdab7
...
...
@@ -37,6 +37,7 @@
#include "wine/exception.h"
#include "global.h"
#include "stackframe.h"
#include "ntdll_misc.h"
#include "wine/debug.h"
...
...
@@ -388,7 +389,7 @@ static HANDLER_DEF(usr1_handler)
/* wait with 0 timeout, will only return once the thread is no longer suspended */
timeout
.
QuadPart
=
0
;
N
tWaitForMultipleObjects
(
0
,
NULL
,
FALSE
,
FALSE
,
&
timeout
);
N
TDLL_wait_for_multiple_objects
(
0
,
NULL
,
0
,
&
timeout
);
}
...
...
dlls/ntdll/sync.c
View file @
217fdab7
...
...
@@ -547,48 +547,102 @@ static void call_apcs( BOOL alertable )
}
}
/* wait operations */
/******************************************************************
* NtWaitForMultipleObjects (NTDLL.@)
/***********************************************************************
* NTDLL_wait_for_multiple_objects
*
* Implementation of NtWaitForMultipleObjects
*/
NTSTATUS
WINAPI
NtWaitForMultipleObjects
(
DWORD
count
,
const
HANDLE
*
handles
,
BOOLEAN
wait_all
,
BOOLEAN
alertable
,
PLARGE_INTEGER
timeout
)
NTSTATUS
NTDLL_wait_for_multiple_objects
(
UINT
count
,
const
HANDLE
*
handles
,
UINT
flags
,
const
LARGE_INTEGER
*
timeout
)
{
int
ret
,
cookie
;
if
(
count
>
MAXIMUM_WAIT_OBJECTS
)
return
STATUS_INVALID_PARAMETER_1
;
NTSTATUS
ret
;
int
cookie
;
if
(
timeout
)
flags
|=
SELECT_TIMEOUT
;
for
(;;)
{
SERVER_START_REQ
(
select
)
{
req
->
flags
=
SELECT_INTERRUPTIBLE
;
req
->
flags
=
flags
;
req
->
cookie
=
&
cookie
;
NTDLL_get_server_timeout
(
&
req
->
timeout
,
timeout
);
wine_server_add_data
(
req
,
handles
,
count
*
sizeof
(
HANDLE
)
);
if
(
wait_all
)
req
->
flags
|=
SELECT_ALL
;
if
(
alertable
)
req
->
flags
|=
SELECT_ALERTABLE
;
if
(
timeout
)
req
->
flags
|=
SELECT_TIMEOUT
;
ret
=
wine_server_call
(
req
);
}
SERVER_END_REQ
;
if
(
ret
==
STATUS_PENDING
)
ret
=
wait_reply
(
&
cookie
);
if
(
ret
!=
STATUS_USER_APC
)
break
;
call_apcs
(
alertable
);
if
(
alertable
)
break
;
call_apcs
(
(
flags
&
SELECT_ALERTABLE
)
!=
0
);
if
(
flags
&
SELECT_ALERTABLE
)
break
;
}
return
ret
;
}
/* wait operations */
/******************************************************************
* NtWaitForMultipleObjects (NTDLL.@)
*/
NTSTATUS
WINAPI
NtWaitForMultipleObjects
(
DWORD
count
,
const
HANDLE
*
handles
,
BOOLEAN
wait_all
,
BOOLEAN
alertable
,
const
LARGE_INTEGER
*
timeout
)
{
UINT
flags
=
SELECT_INTERRUPTIBLE
;
if
(
!
count
||
count
>
MAXIMUM_WAIT_OBJECTS
)
return
STATUS_INVALID_PARAMETER_1
;
if
(
wait_all
)
flags
|=
SELECT_ALL
;
if
(
alertable
)
flags
|=
SELECT_ALERTABLE
;
return
NTDLL_wait_for_multiple_objects
(
count
,
handles
,
flags
,
timeout
);
}
/******************************************************************
* NtWaitForSingleObject (NTDLL.@)
*/
NTSTATUS
WINAPI
NtWaitForSingleObject
(
HANDLE
handle
,
BOOLEAN
alertable
,
PLARGE_INTEGER
timeout
)
NTSTATUS
WINAPI
NtWaitForSingleObject
(
HANDLE
handle
,
BOOLEAN
alertable
,
const
LARGE_INTEGER
*
timeout
)
{
return
NtWaitForMultipleObjects
(
1
,
&
handle
,
FALSE
,
alertable
,
timeout
);
}
/******************************************************************
* NtDelayExecution (NTDLL.@)
*/
NTSTATUS
WINAPI
NtDelayExecution
(
BOOLEAN
alertable
,
const
LARGE_INTEGER
*
timeout
)
{
/* if alertable or async I/O in progress, we need to query the server */
if
(
alertable
||
NtCurrentTeb
()
->
pending_list
)
{
UINT
flags
=
SELECT_INTERRUPTIBLE
;
if
(
alertable
)
flags
|=
SELECT_ALERTABLE
;
return
NTDLL_wait_for_multiple_objects
(
0
,
NULL
,
flags
,
timeout
);
}
if
(
!
timeout
)
/* sleep forever */
{
for
(;;)
select
(
0
,
NULL
,
NULL
,
NULL
,
NULL
);
}
else
{
abs_time_t
when
;
NTDLL_get_server_timeout
(
&
when
,
timeout
);
for
(;;)
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
tv
.
tv_sec
=
when
.
sec
-
tv
.
tv_sec
;
if
((
tv
.
tv_usec
=
when
.
usec
-
tv
.
tv_usec
)
<
0
)
{
tv
.
tv_usec
+=
1000000
;
tv
.
tv_sec
--
;
}
if
(
tv
.
tv_sec
<
0
)
tv
.
tv_sec
=
tv
.
tv_usec
=
0
;
if
(
select
(
0
,
NULL
,
NULL
,
NULL
,
&
tv
)
!=
-
1
)
break
;
}
}
return
STATUS_SUCCESS
;
}
include/winternl.h
View file @
217fdab7
...
...
@@ -924,6 +924,7 @@ NTSTATUS WINAPI NtCreateKey(PHKEY,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,co
NTSTATUS
WINAPI
NtCreateSection
(
HANDLE
*
,
ACCESS_MASK
,
const
OBJECT_ATTRIBUTES
*
,
const
LARGE_INTEGER
*
,
ULONG
,
ULONG
,
HANDLE
);
NTSTATUS
WINAPI
NtCreateSemaphore
(
PHANDLE
,
ACCESS_MASK
,
const
OBJECT_ATTRIBUTES
*
,
ULONG
,
ULONG
);
NTSTATUS
WINAPI
NtCreateTimer
(
HANDLE
*
,
ACCESS_MASK
,
const
OBJECT_ATTRIBUTES
*
,
TIMER_TYPE
);
NTSTATUS
WINAPI
NtDelayExecution
(
BOOLEAN
,
const
LARGE_INTEGER
*
);
NTSTATUS
WINAPI
NtDeleteKey
(
HKEY
);
NTSTATUS
WINAPI
NtDeleteValueKey
(
HKEY
,
const
UNICODE_STRING
*
);
NTSTATUS
WINAPI
NtDeviceIoControlFile
(
HANDLE
,
HANDLE
,
PIO_APC_ROUTINE
,
PVOID
,
PIO_STATUS_BLOCK
,
ULONG
,
PVOID
,
ULONG
,
PVOID
,
ULONG
);
...
...
@@ -989,8 +990,8 @@ NTSTATUS WINAPI NtUnloadKey(HKEY);
NTSTATUS
WINAPI
NtUnlockFile
(
HANDLE
,
PIO_STATUS_BLOCK
,
PLARGE_INTEGER
,
PLARGE_INTEGER
,
PULONG
);
NTSTATUS
WINAPI
NtUnlockVirtualMemory
(
HANDLE
,
PVOID
*
,
ULONG
*
,
ULONG
);
NTSTATUS
WINAPI
NtUnmapViewOfSection
(
HANDLE
,
PVOID
);
NTSTATUS
WINAPI
NtWaitForSingleObject
(
HANDLE
,
BOOLEAN
,
PLARGE_INTEGER
);
NTSTATUS
WINAPI
NtWaitForMultipleObjects
(
ULONG
,
const
HANDLE
*
,
BOOLEAN
,
BOOLEAN
,
PLARGE_INTEGER
);
NTSTATUS
WINAPI
NtWaitForSingleObject
(
HANDLE
,
BOOLEAN
,
const
LARGE_INTEGER
*
);
NTSTATUS
WINAPI
NtWaitForMultipleObjects
(
ULONG
,
const
HANDLE
*
,
BOOLEAN
,
BOOLEAN
,
const
LARGE_INTEGER
*
);
NTSTATUS
WINAPI
NtWriteFile
(
HANDLE
,
HANDLE
,
PIO_APC_ROUTINE
,
PVOID
,
PIO_STATUS_BLOCK
,
const
void
*
,
ULONG
,
PLARGE_INTEGER
,
PULONG
);
void
WINAPI
RtlAcquirePebLock
(
void
);
...
...
scheduler/synchro.c
View file @
217fdab7
...
...
@@ -30,7 +30,7 @@
*/
VOID
WINAPI
Sleep
(
DWORD
timeout
)
{
WaitForMultipleObjectsEx
(
0
,
NULL
,
FALSE
,
timeout
,
FALSE
);
SleepEx
(
timeout
,
FALSE
);
}
/******************************************************************************
...
...
@@ -38,9 +38,19 @@ VOID WINAPI Sleep( DWORD timeout )
*/
DWORD
WINAPI
SleepEx
(
DWORD
timeout
,
BOOL
alertable
)
{
DWORD
ret
=
WaitForMultipleObjectsEx
(
0
,
NULL
,
FALSE
,
timeout
,
alertable
);
if
(
ret
!=
WAIT_IO_COMPLETION
)
ret
=
0
;
return
ret
;
NTSTATUS
status
;
if
(
timeout
==
INFINITE
)
status
=
NtDelayExecution
(
alertable
,
NULL
);
else
{
LARGE_INTEGER
time
;
time
.
QuadPart
=
timeout
*
(
ULONGLONG
)
10000
;
time
.
QuadPart
=
-
time
.
QuadPart
;
status
=
NtDelayExecution
(
alertable
,
&
time
);
}
if
(
status
!=
STATUS_USER_APC
)
status
=
STATUS_SUCCESS
;
return
status
;
}
...
...
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