Commit de91a8dd authored by Alexandre Julliard's avatar Alexandre Julliard

Implemented NtYieldExecution.

parent 5f21fd47
......@@ -242,17 +242,6 @@ LONG WINAPI KERNEL_nop(void)
}
/***********************************************************************
* SwitchToThread (KERNEL32.@)
*/
BOOL WINAPI SwitchToThread(void)
{
Sleep(0);
return 1;
}
/***********************************************************************
* MulDiv (KERNEL32.@)
* RETURNS
* Result of multiplication and division
......
......@@ -92,6 +92,15 @@ DWORD WINAPI SleepEx( DWORD timeout, BOOL alertable )
/***********************************************************************
* SwitchToThread (KERNEL32.@)
*/
BOOL WINAPI SwitchToThread(void)
{
return (NtYieldExecution() != STATUS_NO_YIELD_PERFORMED);
}
/***********************************************************************
* WaitForSingleObject (KERNEL32.@)
*/
DWORD WINAPI WaitForSingleObject( HANDLE handle, DWORD timeout )
......
......@@ -270,6 +270,7 @@
@ stdcall NtWriteFile(long long ptr ptr ptr ptr long ptr ptr)
@ stub NtWriteRequestData
@ stdcall NtWriteVirtualMemory(long ptr ptr long ptr)
@ stdcall NtYieldExecution()
@ stub PfxFindPrefix
@ stub PfxInitialize
@ stub PfxInsertPrefix
......@@ -1079,7 +1080,6 @@
@ stub NtReadFileScatter
@ stub NtSignalAndWaitForSingleObject
@ stub NtWriteFileGather
@ stub NtYieldExecution
@ stub RtlAddAtomToAtomTable
@ stub RtlAllocateHandle
@ stub RtlCreateAtomTable
......
......@@ -619,6 +619,20 @@ NTSTATUS WINAPI NtWaitForSingleObject(HANDLE handle, BOOLEAN alertable, const LA
/******************************************************************
* NtYieldExecution (NTDLL.@)
*/
NTSTATUS WINAPI NtYieldExecution(void)
{
#ifdef HAVE_SCHED_YIELD
sched_yield();
return STATUS_SUCCESS;
#else
return STATUS_NO_YIELD_PERFORMED;
#endif
}
/******************************************************************
* NtDelayExecution (NTDLL.@)
*/
NTSTATUS WINAPI NtDelayExecution( BOOLEAN alertable, const LARGE_INTEGER *timeout )
......@@ -635,9 +649,10 @@ NTSTATUS WINAPI NtDelayExecution( BOOLEAN alertable, const LARGE_INTEGER *timeou
{
for (;;) select( 0, NULL, NULL, NULL, NULL );
}
#ifdef HAVE_SCHED_YIELD
else if (!timeout->QuadPart) sched_yield();
#endif
else if (!timeout->QuadPart)
{
NtYieldExecution();
}
else
{
abs_time_t when;
......
......@@ -1371,6 +1371,7 @@ 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);
NTSTATUS WINAPI NtWriteVirtualMemory(HANDLE,void*,const void*,SIZE_T,SIZE_T*);
NTSTATUS WINAPI NtYieldExecution(void);
void WINAPI RtlAcquirePebLock(void);
BYTE WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK,BYTE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment