winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
July 2015
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
567 discussions
Start a n
N
ew thread
Matteo Bruni : wined3d: Replace an open-coded implementation of LIST_FOR_EACH_ENTRY_SAFE.
by Alexandre Julliard
03 Jul '15
03 Jul '15
Module: wine Branch: master Commit: 30031f6da48ac76fdb9f4c400b5091177e910165 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=30031f6da48ac76fdb9f4c400…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Thu Jul 2 17:41:32 2015 +0200 wined3d: Replace an open-coded implementation of LIST_FOR_EACH_ENTRY_SAFE. --- dlls/wined3d/shader.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 5b32528..e9be51e 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -409,16 +409,10 @@ static unsigned int shader_get_float_offset(enum wined3d_shader_register_type re static void shader_delete_constant_list(struct list *clist) { - struct wined3d_shader_lconst *constant; - struct list *ptr; + struct wined3d_shader_lconst *constant, *constant_next; - ptr = list_head(clist); - while (ptr) - { - constant = LIST_ENTRY(ptr, struct wined3d_shader_lconst, entry); - ptr = list_next(clist, ptr); + LIST_FOR_EACH_ENTRY_SAFE(constant, constant_next, clist, struct wined3d_shader_lconst, entry) HeapFree(GetProcessHeap(), 0, constant); - } list_init(clist); } @@ -2046,6 +2040,11 @@ static HRESULT shader_set_function(struct wined3d_shader *shader, const DWORD *b TRACE("shader %p, byte_code %p, output_signature %p, float_const_count %u.\n", shader, byte_code, output_signature, float_const_count); + list_init(&shader->constantsF); + list_init(&shader->constantsB); + list_init(&shader->constantsI); + shader->lconst_inf_or_nan = FALSE; + fe = shader_select_frontend(*byte_code); if (!fe) { @@ -2064,12 +2063,6 @@ static HRESULT shader_set_function(struct wined3d_shader *shader, const DWORD *b if (TRACE_ON(d3d_shader)) shader_trace_init(fe, shader->frontend_data, byte_code); - /* Initialize immediate constant lists. */ - list_init(&shader->constantsF); - list_init(&shader->constantsB); - list_init(&shader->constantsI); - shader->lconst_inf_or_nan = FALSE; - /* Second pass: figure out which registers are used, what the semantics are, etc. */ if (FAILED(hr = shader_get_registers_used(shader, fe, reg_maps, &shader->input_signature, &shader->output_signature, byte_code, float_const_count)))
1
0
0
0
Matteo Bruni : wined3d: Fix GLSL backend with non-GLSL vertex and pixel pipeline combination.
by Alexandre Julliard
03 Jul '15
03 Jul '15
Module: wine Branch: master Commit: 93c88d34a8a7e9aa1ff9c20626e9580948c07e99 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=93c88d34a8a7e9aa1ff9c2062…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Thu Jul 2 17:41:31 2015 +0200 wined3d: Fix GLSL backend with non-GLSL vertex and pixel pipeline combination. That can only happen by manually modifying select_vertex_implementation() and select_fragment_implementation(), which may be useful for testing non-default vertex / fragment pipeline implementations. --- dlls/wined3d/glsl_shader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 1f6ce09..54922e1 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -6584,7 +6584,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const WORD attribs_map; struct wined3d_string_buffer *tmp_name; - if (!(context->shader_update_mask & (1 << WINED3D_SHADER_TYPE_VERTEX))) + if (!(context->shader_update_mask & (1 << WINED3D_SHADER_TYPE_VERTEX)) && ctx_data->glsl_program) { vs_id = ctx_data->glsl_program->vs.id; vs_list = &ctx_data->glsl_program->vs.shader_entry; @@ -6624,7 +6624,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const vs_list = &ffp_shader->linked_programs; } - if (!(context->shader_update_mask & (1 << WINED3D_SHADER_TYPE_PIXEL))) + if (!(context->shader_update_mask & (1 << WINED3D_SHADER_TYPE_PIXEL)) && ctx_data->glsl_program) { ps_id = ctx_data->glsl_program->ps.id; ps_list = &ctx_data->glsl_program->ps.shader_entry;
1
0
0
0
Sebastian Lackner : kernel32/tests: Fix leak of threadpool object.
by Alexandre Julliard
03 Jul '15
03 Jul '15
Module: wine Branch: master Commit: d2a3c9c20ef25e399046ce21d3b9d75e97702905 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d2a3c9c20ef25e399046ce21d…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Fri Jul 3 02:00:59 2015 +0200 kernel32/tests: Fix leak of threadpool object. --- dlls/kernel32/tests/thread.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c index 25801b2..35e978e 100644 --- a/dlls/kernel32/tests/thread.c +++ b/dlls/kernel32/tests/thread.c @@ -86,6 +86,7 @@ static BOOL (WINAPI *pDeactivateActCtx)(DWORD,ULONG_PTR); static BOOL (WINAPI *pGetCurrentActCtx)(HANDLE *); static void (WINAPI *pReleaseActCtx)(HANDLE); static PTP_POOL (WINAPI *pCreateThreadpool)(PVOID); +static void (WINAPI *pCloseThreadpool)(PTP_POOL); static PTP_WORK (WINAPI *pCreateThreadpoolWork)(PTP_WORK_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON); static void (WINAPI *pSubmitThreadpoolWork)(PTP_WORK); static void (WINAPI *pWaitForThreadpoolWorkCallbacks)(PTP_WORK,BOOL); @@ -1641,6 +1642,7 @@ static void test_threadpool(void) pool = pCreateThreadpool(NULL); ok (pool != NULL, "CreateThreadpool failed\n"); + pCloseThreadpool(pool); } static void test_reserved_tls(void) @@ -1705,6 +1707,7 @@ static void init_funcs(void) X(ReleaseActCtx); X(CreateThreadpool); + X(CloseThreadpool); X(CreateThreadpoolWork); X(SubmitThreadpoolWork); X(WaitForThreadpoolWorkCallbacks);
1
0
0
0
Sebastian Lackner : kernel32: Forward remaining threadpool functions to ntdll.
by Alexandre Julliard
03 Jul '15
03 Jul '15
Module: wine Branch: master Commit: eadd27a38a218e6ab27404d2981f3fe521f13361 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=eadd27a38a218e6ab27404d29…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Fri Jul 3 02:00:31 2015 +0200 kernel32: Forward remaining threadpool functions to ntdll. --- dlls/kernel32/kernel32.spec | 10 +++++----- dlls/kernel32/tests/thread.c | 6 +++--- dlls/kernel32/thread.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/winternl.h | 5 +++++ 4 files changed, 53 insertions(+), 8 deletions(-) diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 0825bdb..a14d03b 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -228,7 +228,7 @@ # @ stub ClosePrivateNamespace @ stdcall CloseProfileUserMapping() @ stub CloseSystemHandle -# @ stub CloseThreadpool +@ stdcall CloseThreadpool(ptr) ntdll.TpReleasePool @ stdcall CloseThreadpoolCleanupGroup(ptr) ntdll.TpReleaseCleanupGroup @ stdcall CloseThreadpoolCleanupGroupMembers(ptr long ptr) ntdll.TpReleaseCleanupGroupMembers # @ stub CloseThreadpoolIo @@ -331,7 +331,7 @@ @ stdcall CreateSymbolicLinkW(wstr wstr long) @ stdcall CreateTapePartition(long long long long) @ stdcall CreateThread(ptr long ptr long long ptr) -# @ stub CreateThreadpool +@ stdcall CreateThreadpool(ptr) @ stdcall CreateThreadpoolCleanupGroup() # @ stub CreateThreadpoolIo @ stdcall CreateThreadpoolTimer(ptr ptr ptr) @@ -1454,8 +1454,8 @@ # @ stub SetThreadToken @ stdcall SetThreadUILanguage(long) # @ stub SetThreadpoolStackInformation -# @ stub SetThreadpoolThreadMaximum -# @ stub SetThreadpoolThreadMinimum +@ stdcall SetThreadpoolThreadMaximum(ptr long) ntdll.TpSetPoolMaxThreads +@ stdcall SetThreadpoolThreadMinimum(ptr long) ntdll.TpSetPoolMinThreads @ stdcall SetThreadpoolTimer(ptr ptr long long) # @ stub SetThreadpoolWait @ stdcall SetTimeZoneInformation(ptr) @@ -1509,7 +1509,7 @@ @ stdcall TryAcquireSRWLockExclusive(ptr) ntdll.RtlTryAcquireSRWLockExclusive @ stdcall TryAcquireSRWLockShared(ptr) ntdll.RtlTryAcquireSRWLockShared @ stdcall TryEnterCriticalSection(ptr) ntdll.RtlTryEnterCriticalSection -# @ stub TrySubmitThreadpoolCallback +@ stdcall TrySubmitThreadpoolCallback(ptr ptr ptr) @ stdcall TzSpecificLocalTimeToSystemTime(ptr ptr ptr) # @ stub TzSpecificLocalTimeToSystemTimeEx # @ stub -arch=x86_64 uaw_lstrcmpW diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c index d3ecd2a..25801b2 100644 --- a/dlls/kernel32/tests/thread.c +++ b/dlls/kernel32/tests/thread.c @@ -1627,8 +1627,8 @@ static void test_threadpool(void) int workcalled = 0; if (!pCreateThreadpool) { - todo_wine win_skip("thread pool apis not supported.\n"); - return; + win_skip("thread pool apis not supported.\n"); + return; } work = pCreateThreadpoolWork(threadpool_workcallback, &workcalled, NULL); @@ -1640,7 +1640,7 @@ static void test_threadpool(void) ok (workcalled == 1, "expected work to be called once, got %d\n", workcalled); pool = pCreateThreadpool(NULL); - todo_wine ok (pool != NULL, "CreateThreadpool failed\n"); + ok (pool != NULL, "CreateThreadpool failed\n"); } static void test_reserved_tls(void) diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c index c8e906d..21ec276 100644 --- a/dlls/kernel32/thread.c +++ b/dlls/kernel32/thread.c @@ -881,6 +881,26 @@ BOOL WINAPI CallbackMayRunLong( TP_CALLBACK_INSTANCE *instance ) } /*********************************************************************** + * CreateThreadpool (KERNEL32.@) + */ +PTP_POOL WINAPI CreateThreadpool( PVOID reserved ) +{ + TP_POOL *pool; + NTSTATUS status; + + TRACE( "%p\n", reserved ); + + status = TpAllocPool( &pool, reserved ); + if (status) + { + SetLastError( RtlNtStatusToDosError(status) ); + return NULL; + } + + return pool; +} + +/*********************************************************************** * CreateThreadpoolCleanupGroup (KERNEL32.@) */ PTP_CLEANUP_GROUP WINAPI CreateThreadpoolCleanupGroup( void ) @@ -960,3 +980,23 @@ VOID WINAPI SetThreadpoolTimer( TP_TIMER *timer, FILETIME *due_time, TpSetTimer( timer, due_time ? &timeout : NULL, period, window_length ); } + +/*********************************************************************** + * TrySubmitThreadpoolCallback (KERNEL32.@) + */ +BOOL WINAPI TrySubmitThreadpoolCallback( PTP_SIMPLE_CALLBACK callback, PVOID userdata, + TP_CALLBACK_ENVIRON *environment ) +{ + NTSTATUS status; + + TRACE( "%p, %p, %p\n", callback, userdata, environment ); + + status = TpSimpleTryPost( callback, userdata, environment ); + if (status) + { + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; + } + + return TRUE; +} diff --git a/include/winternl.h b/include/winternl.h index 5b07994..e1707fd 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2619,6 +2619,7 @@ NTSYSAPI NTSTATUS WINAPI RtlLargeIntegerToChar(const ULONGLONG *,ULONG,ULONG,PC /* Threadpool functions */ NTSYSAPI NTSTATUS WINAPI TpAllocCleanupGroup(TP_CLEANUP_GROUP **); +NTSYSAPI NTSTATUS WINAPI TpAllocPool(TP_POOL **,PVOID); NTSYSAPI NTSTATUS WINAPI TpAllocTimer(TP_TIMER **,PTP_TIMER_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); NTSYSAPI NTSTATUS WINAPI TpAllocWork(TP_WORK **,PTP_WORK_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); NTSYSAPI void WINAPI TpCallbackLeaveCriticalSectionOnCompletion(TP_CALLBACK_INSTANCE *,RTL_CRITICAL_SECTION *); @@ -2632,9 +2633,13 @@ NTSYSAPI BOOL WINAPI TpIsTimerSet(TP_TIMER *); NTSYSAPI void WINAPI TpPostWork(TP_WORK *); NTSYSAPI void WINAPI TpReleaseCleanupGroup(TP_CLEANUP_GROUP *); NTSYSAPI void WINAPI TpReleaseCleanupGroupMembers(TP_CLEANUP_GROUP *,BOOL,PVOID); +NTSYSAPI void WINAPI TpReleasePool(TP_POOL *); NTSYSAPI void WINAPI TpReleaseTimer(TP_TIMER *); NTSYSAPI void WINAPI TpReleaseWork(TP_WORK *); +NTSYSAPI void WINAPI TpSetPoolMaxThreads(TP_POOL *,DWORD); +NTSYSAPI BOOL WINAPI TpSetPoolMinThreads(TP_POOL *,DWORD); NTSYSAPI void WINAPI TpSetTimer(TP_TIMER *, LARGE_INTEGER *,LONG,LONG); +NTSYSAPI NTSTATUS WINAPI TpSimpleTryPost(PTP_SIMPLE_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); NTSYSAPI void WINAPI TpWaitForTimer(TP_TIMER *,BOOL); NTSYSAPI void WINAPI TpWaitForWork(TP_WORK *,BOOL);
1
0
0
0
Sebastian Lackner : kernel32: Forward threadpool instance functions to ntdll.
by Alexandre Julliard
03 Jul '15
03 Jul '15
Module: wine Branch: master Commit: 56b9af1150b706ed410f0bb0836f72cf6d9e8a19 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=56b9af1150b706ed410f0bb08…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Fri Jul 3 02:00:14 2015 +0200 kernel32: Forward threadpool instance functions to ntdll. --- dlls/kernel32/kernel32.spec | 14 +++++++------- dlls/kernel32/thread.c | 19 +++++++++++++++++++ include/winternl.h | 7 +++++++ 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 3d3a68b..0825bdb 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -204,7 +204,7 @@ @ stdcall BuildCommDCBAndTimeoutsA(str ptr ptr) @ stdcall BuildCommDCBAndTimeoutsW(wstr ptr ptr) @ stdcall BuildCommDCBW(wstr ptr) -# @ stub CallbackMayRunLong +@ stdcall CallbackMayRunLong(ptr) @ stdcall CallNamedPipeA(str ptr long ptr long ptr long) @ stdcall CallNamedPipeW(wstr ptr long ptr long ptr long) @ stub CancelDeviceWakeupRequest @@ -369,7 +369,7 @@ @ stdcall DeleteFileW(wstr) # @ stub DeleteProcThreadAttributeList # @ stub DisableThreadProfiling -# @ stub DisassociateCurrentThreadFromCallback +@ stdcall DisassociateCurrentThreadFromCallback(ptr) ntdll.TpDisassociateCallback @ stdcall DeleteTimerQueue(long) @ stdcall DeleteTimerQueueEx (long long) @ stdcall DeleteTimerQueueTimer(long long long) @@ -495,7 +495,6 @@ @ stdcall FindFirstVolumeMountPointA(str ptr long) @ stdcall FindFirstVolumeMountPointW(wstr ptr long) @ stdcall FindFirstVolumeW(ptr long) -# @ stub FreeLibraryWhenCallbackReturns @ stdcall FindNextChangeNotification(long) @ stdcall FindNextFileA(long ptr) # @ stub FindNextFileNameW @@ -533,6 +532,7 @@ @ stub -i386 FreeLSCallback @ stdcall FreeLibrary(long) @ stdcall FreeLibraryAndExitThread(long long) +@ stdcall FreeLibraryWhenCallbackReturns(ptr ptr) ntdll.TpCallbackUnloadDllOnCompletion @ stdcall FreeResource(long) @ stdcall -i386 -private FreeSLCallback(long) krnl386.exe16.FreeSLCallback @ stub FreeUserPhysicalPages @@ -1035,7 +1035,7 @@ @ stdcall LZSeek(long long long) @ stdcall LZStart() @ stdcall LeaveCriticalSection(ptr) ntdll.RtlLeaveCriticalSection -# @ stub LeaveCriticalSectionWhenCallbackReturns +@ stdcall LeaveCriticalSectionWhenCallbackReturns(ptr ptr) ntdll.TpCallbackLeaveCriticalSectionOnCompletion # @ stub LoadAppInitDlls @ stdcall LoadLibraryA(str) @ stdcall LoadLibraryExA( str long long) @@ -1252,9 +1252,9 @@ @ stdcall ReinitializeCriticalSection(ptr) @ stdcall ReleaseActCtx(ptr) @ stdcall ReleaseMutex(long) -# @ stub ReleaseMutexWhenCallbackReturns +@ stdcall ReleaseMutexWhenCallbackReturns(ptr long) ntdll.TpCallbackReleaseMutexOnCompletion @ stdcall ReleaseSemaphore(long long ptr) -# @ stub ReleaseSemaphoreWhenCallbackReturns +@ stdcall ReleaseSemaphoreWhenCallbackReturns(ptr long long) ntdll.TpCallbackReleaseSemaphoreOnCompletion @ stdcall ReleaseSRWLockExclusive(ptr) ntdll.RtlReleaseSRWLockExclusive @ stdcall ReleaseSRWLockShared(ptr) ntdll.RtlReleaseSRWLockShared @ stdcall RemoveDirectoryA(str) @@ -1385,7 +1385,7 @@ @ stdcall SetEnvironmentVariableW(wstr wstr) @ stdcall SetErrorMode(long) @ stdcall SetEvent(long) -# @ stub SetEventWhenCallbackReturns +@ stdcall SetEventWhenCallbackReturns(ptr long) ntdll.TpCallbackSetEventOnCompletion @ stdcall SetFileApisToANSI() @ stdcall SetFileApisToOEM() @ stdcall SetFileAttributesA(str long) diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c index 1ca0945..c8e906d 100644 --- a/dlls/kernel32/thread.c +++ b/dlls/kernel32/thread.c @@ -862,6 +862,25 @@ BOOL WINAPI GetThreadPreferredUILanguages( DWORD flags, PULONG count, PCZZWSTR b } /*********************************************************************** + * CallbackMayRunLong (KERNEL32.@) + */ +BOOL WINAPI CallbackMayRunLong( TP_CALLBACK_INSTANCE *instance ) +{ + NTSTATUS status; + + TRACE( "%p\n", instance ); + + status = TpCallbackMayRunLong( instance ); + if (status) + { + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; + } + + return TRUE; +} + +/*********************************************************************** * CreateThreadpoolCleanupGroup (KERNEL32.@) */ PTP_CLEANUP_GROUP WINAPI CreateThreadpoolCleanupGroup( void ) diff --git a/include/winternl.h b/include/winternl.h index ab64a71..5b07994 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2621,6 +2621,13 @@ NTSYSAPI NTSTATUS WINAPI RtlLargeIntegerToChar(const ULONGLONG *,ULONG,ULONG,PC NTSYSAPI NTSTATUS WINAPI TpAllocCleanupGroup(TP_CLEANUP_GROUP **); NTSYSAPI NTSTATUS WINAPI TpAllocTimer(TP_TIMER **,PTP_TIMER_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); NTSYSAPI NTSTATUS WINAPI TpAllocWork(TP_WORK **,PTP_WORK_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); +NTSYSAPI void WINAPI TpCallbackLeaveCriticalSectionOnCompletion(TP_CALLBACK_INSTANCE *,RTL_CRITICAL_SECTION *); +NTSYSAPI NTSTATUS WINAPI TpCallbackMayRunLong(TP_CALLBACK_INSTANCE *); +NTSYSAPI void WINAPI TpCallbackReleaseMutexOnCompletion(TP_CALLBACK_INSTANCE *,HANDLE); +NTSYSAPI void WINAPI TpCallbackReleaseSemaphoreOnCompletion(TP_CALLBACK_INSTANCE *,HANDLE,DWORD); +NTSYSAPI void WINAPI TpCallbackSetEventOnCompletion(TP_CALLBACK_INSTANCE *,HANDLE); +NTSYSAPI void WINAPI TpCallbackUnloadDllOnCompletion(TP_CALLBACK_INSTANCE *,HMODULE); +NTSYSAPI void WINAPI TpDisassociateCallback(TP_CALLBACK_INSTANCE *); NTSYSAPI BOOL WINAPI TpIsTimerSet(TP_TIMER *); NTSYSAPI void WINAPI TpPostWork(TP_WORK *); NTSYSAPI void WINAPI TpReleaseCleanupGroup(TP_CLEANUP_GROUP *);
1
0
0
0
Sebastian Lackner : kernel32: Forward threadpool timer functions to ntdll.
by Alexandre Julliard
03 Jul '15
03 Jul '15
Module: wine Branch: master Commit: 4b0ecd3e22b0187ebb6c1f86c51518d85545ac92 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4b0ecd3e22b0187ebb6c1f86c…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Fri Jul 3 01:59:55 2015 +0200 kernel32: Forward threadpool timer functions to ntdll. --- dlls/kernel32/kernel32.spec | 10 +++++----- dlls/kernel32/thread.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/winternl.h | 5 +++++ 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 882013c..3d3a68b 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -232,7 +232,7 @@ @ stdcall CloseThreadpoolCleanupGroup(ptr) ntdll.TpReleaseCleanupGroup @ stdcall CloseThreadpoolCleanupGroupMembers(ptr long ptr) ntdll.TpReleaseCleanupGroupMembers # @ stub CloseThreadpoolIo -# @ stub CloseThreadpoolTimer +@ stdcall CloseThreadpoolTimer(ptr) ntdll.TpReleaseTimer # @ stub CloseThreadpoolWait @ stdcall CloseThreadpoolWork(ptr) ntdll.TpReleaseWork @ stdcall CmdBatNotification(long) @@ -334,7 +334,7 @@ # @ stub CreateThreadpool @ stdcall CreateThreadpoolCleanupGroup() # @ stub CreateThreadpoolIo -# @ stub CreateThreadpoolTimer +@ stdcall CreateThreadpoolTimer(ptr ptr ptr) # @ stub CreateThreadpoolWait @ stdcall CreateThreadpoolWork(ptr ptr ptr) @ stdcall CreateTimerQueue () @@ -981,7 +981,7 @@ @ stub -i386 IsSLCallback @ stdcall IsSystemResumeAutomatic() @ stdcall IsThreadAFiber() -# @ stub IsThreadpoolTimerSet +@ stdcall IsThreadpoolTimerSet(ptr) ntdll.TpIsTimerSet # @ stub IsTimeZoneRedirectionEnabled # @ stub IsValidCalDateTime @ stdcall IsValidCodePage(long) @@ -1456,7 +1456,7 @@ # @ stub SetThreadpoolStackInformation # @ stub SetThreadpoolThreadMaximum # @ stub SetThreadpoolThreadMinimum -# @ stub SetThreadpoolTimer +@ stdcall SetThreadpoolTimer(ptr ptr long long) # @ stub SetThreadpoolWait @ stdcall SetTimeZoneInformation(ptr) @ stub SetTimerQueueTimer @@ -1571,7 +1571,7 @@ @ stdcall WaitForSingleObject(long long) @ stdcall WaitForSingleObjectEx(long long long) # @ stub WaitForThreadpoolIoCallbacks -# @ stub WaitForThreadpoolTimerCallbacks +@ stdcall WaitForThreadpoolTimerCallbacks(ptr long) ntdll.TpWaitForTimer # @ stub WaitForThreadpoolWaitCallbacks @ stdcall WaitForThreadpoolWorkCallbacks(ptr long) ntdll.TpWaitForWork @ stdcall WaitNamedPipeA (str long) diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c index 313295c..1ca0945 100644 --- a/dlls/kernel32/thread.c +++ b/dlls/kernel32/thread.c @@ -882,6 +882,27 @@ PTP_CLEANUP_GROUP WINAPI CreateThreadpoolCleanupGroup( void ) } /*********************************************************************** + * CreateThreadpoolTimer (KERNEL32.@) + */ +PTP_TIMER WINAPI CreateThreadpoolTimer( PTP_TIMER_CALLBACK callback, PVOID userdata, + TP_CALLBACK_ENVIRON *environment ) +{ + TP_TIMER *timer; + NTSTATUS status; + + TRACE( "%p, %p, %p\n", callback, userdata, environment ); + + status = TpAllocTimer( &timer, callback, userdata, environment ); + if (status) + { + SetLastError( RtlNtStatusToDosError(status) ); + return NULL; + } + + return timer; +} + +/*********************************************************************** * CreateThreadpoolWork (KERNEL32.@) */ PTP_WORK WINAPI CreateThreadpoolWork( PTP_WORK_CALLBACK callback, PVOID userdata, @@ -901,3 +922,22 @@ PTP_WORK WINAPI CreateThreadpoolWork( PTP_WORK_CALLBACK callback, PVOID userdata return work; } + +/*********************************************************************** + * SetThreadpoolTimer (KERNEL32.@) + */ +VOID WINAPI SetThreadpoolTimer( TP_TIMER *timer, FILETIME *due_time, + DWORD period, DWORD window_length ) +{ + LARGE_INTEGER timeout; + + TRACE( "%p, %p, %u, %u\n", timer, due_time, period, window_length ); + + if (due_time) + { + timeout.u.LowPart = due_time->dwLowDateTime; + timeout.u.HighPart = due_time->dwHighDateTime; + } + + TpSetTimer( timer, due_time ? &timeout : NULL, period, window_length ); +} diff --git a/include/winternl.h b/include/winternl.h index ab8de5e..ab64a71 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2619,11 +2619,16 @@ NTSYSAPI NTSTATUS WINAPI RtlLargeIntegerToChar(const ULONGLONG *,ULONG,ULONG,PC /* Threadpool functions */ NTSYSAPI NTSTATUS WINAPI TpAllocCleanupGroup(TP_CLEANUP_GROUP **); +NTSYSAPI NTSTATUS WINAPI TpAllocTimer(TP_TIMER **,PTP_TIMER_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); NTSYSAPI NTSTATUS WINAPI TpAllocWork(TP_WORK **,PTP_WORK_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); +NTSYSAPI BOOL WINAPI TpIsTimerSet(TP_TIMER *); NTSYSAPI void WINAPI TpPostWork(TP_WORK *); NTSYSAPI void WINAPI TpReleaseCleanupGroup(TP_CLEANUP_GROUP *); NTSYSAPI void WINAPI TpReleaseCleanupGroupMembers(TP_CLEANUP_GROUP *,BOOL,PVOID); +NTSYSAPI void WINAPI TpReleaseTimer(TP_TIMER *); NTSYSAPI void WINAPI TpReleaseWork(TP_WORK *); +NTSYSAPI void WINAPI TpSetTimer(TP_TIMER *, LARGE_INTEGER *,LONG,LONG); +NTSYSAPI void WINAPI TpWaitForTimer(TP_TIMER *,BOOL); NTSYSAPI void WINAPI TpWaitForWork(TP_WORK *,BOOL); /* Wine internal functions */
1
0
0
0
Sebastian Lackner : kernel32: Forward threadpool work functions to ntdll.
by Alexandre Julliard
03 Jul '15
03 Jul '15
Module: wine Branch: master Commit: 1165cc095359d64c6ef3d63f3a1511afe9f09aab URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1165cc095359d64c6ef3d63f3…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Fri Jul 3 01:59:38 2015 +0200 kernel32: Forward threadpool work functions to ntdll. --- dlls/kernel32/kernel32.spec | 8 ++++---- dlls/kernel32/thread.c | 21 +++++++++++++++++++++ include/winternl.h | 4 ++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index b48ea3b..882013c 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -234,7 +234,7 @@ # @ stub CloseThreadpoolIo # @ stub CloseThreadpoolTimer # @ stub CloseThreadpoolWait -# @ stub CloseThreadpoolWork +@ stdcall CloseThreadpoolWork(ptr) ntdll.TpReleaseWork @ stdcall CmdBatNotification(long) @ stdcall CommConfigDialogA(str long ptr) @ stdcall CommConfigDialogW(wstr long ptr) @@ -336,7 +336,7 @@ # @ stub CreateThreadpoolIo # @ stub CreateThreadpoolTimer # @ stub CreateThreadpoolWait -# @ stub CreateThreadpoolWork +@ stdcall CreateThreadpoolWork(ptr ptr ptr) @ stdcall CreateTimerQueue () @ stdcall CreateTimerQueueTimer(ptr long ptr ptr long long long) @ stdcall CreateToolhelp32Snapshot(long long) @@ -1482,7 +1482,7 @@ # @ stub SortCloseHandle # @ stub SortGetHandle # @ stub StartThreadpoolIo -# @ stub SubmitThreadpoolWork +@ stdcall SubmitThreadpoolWork(ptr) ntdll.TpPostWork @ stdcall SuspendThread(long) @ stdcall SwitchToFiber(ptr) @ stdcall SwitchToThread() @@ -1573,7 +1573,7 @@ # @ stub WaitForThreadpoolIoCallbacks # @ stub WaitForThreadpoolTimerCallbacks # @ stub WaitForThreadpoolWaitCallbacks -# @ stub WaitForThreadpoolWorkCallbacks +@ stdcall WaitForThreadpoolWorkCallbacks(ptr long) ntdll.TpWaitForWork @ stdcall WaitNamedPipeA (str long) @ stdcall WaitNamedPipeW (wstr long) @ stdcall WakeAllConditionVariable(ptr) ntdll.RtlWakeAllConditionVariable diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c index b2b9def..313295c 100644 --- a/dlls/kernel32/thread.c +++ b/dlls/kernel32/thread.c @@ -880,3 +880,24 @@ PTP_CLEANUP_GROUP WINAPI CreateThreadpoolCleanupGroup( void ) return group; } + +/*********************************************************************** + * CreateThreadpoolWork (KERNEL32.@) + */ +PTP_WORK WINAPI CreateThreadpoolWork( PTP_WORK_CALLBACK callback, PVOID userdata, + TP_CALLBACK_ENVIRON *environment ) +{ + TP_WORK *work; + NTSTATUS status; + + TRACE( "%p, %p, %p\n", callback, userdata, environment ); + + status = TpAllocWork( &work, callback, userdata, environment ); + if (status) + { + SetLastError( RtlNtStatusToDosError(status) ); + return NULL; + } + + return work; +} diff --git a/include/winternl.h b/include/winternl.h index c918e09..ab8de5e 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2619,8 +2619,12 @@ NTSYSAPI NTSTATUS WINAPI RtlLargeIntegerToChar(const ULONGLONG *,ULONG,ULONG,PC /* Threadpool functions */ NTSYSAPI NTSTATUS WINAPI TpAllocCleanupGroup(TP_CLEANUP_GROUP **); +NTSYSAPI NTSTATUS WINAPI TpAllocWork(TP_WORK **,PTP_WORK_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); +NTSYSAPI void WINAPI TpPostWork(TP_WORK *); NTSYSAPI void WINAPI TpReleaseCleanupGroup(TP_CLEANUP_GROUP *); NTSYSAPI void WINAPI TpReleaseCleanupGroupMembers(TP_CLEANUP_GROUP *,BOOL,PVOID); +NTSYSAPI void WINAPI TpReleaseWork(TP_WORK *); +NTSYSAPI void WINAPI TpWaitForWork(TP_WORK *,BOOL); /* Wine internal functions */
1
0
0
0
Sebastian Lackner : kernel32: Forward threadpool cleanup group functions to ntdll.
by Alexandre Julliard
03 Jul '15
03 Jul '15
Module: wine Branch: master Commit: a54d972868f03ed38bb98c3a0d9888a777e9b7ec URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a54d972868f03ed38bb98c3a0…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Fri Jul 3 01:59:22 2015 +0200 kernel32: Forward threadpool cleanup group functions to ntdll. --- dlls/kernel32/kernel32.spec | 6 +++--- dlls/kernel32/thread.c | 20 ++++++++++++++++++++ include/winternl.h | 6 ++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 3c40975..b48ea3b 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -229,8 +229,8 @@ @ stdcall CloseProfileUserMapping() @ stub CloseSystemHandle # @ stub CloseThreadpool -# @ stub CloseThreadpoolCleanupGroup -# @ stub CloseThreadpoolCleanupGroupMembers +@ stdcall CloseThreadpoolCleanupGroup(ptr) ntdll.TpReleaseCleanupGroup +@ stdcall CloseThreadpoolCleanupGroupMembers(ptr long ptr) ntdll.TpReleaseCleanupGroupMembers # @ stub CloseThreadpoolIo # @ stub CloseThreadpoolTimer # @ stub CloseThreadpoolWait @@ -332,7 +332,7 @@ @ stdcall CreateTapePartition(long long long long) @ stdcall CreateThread(ptr long ptr long long ptr) # @ stub CreateThreadpool -# @ stub CreateThreadpoolCleanupGroup +@ stdcall CreateThreadpoolCleanupGroup() # @ stub CreateThreadpoolIo # @ stub CreateThreadpoolTimer # @ stub CreateThreadpoolWait diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c index 3dabf94..b2b9def 100644 --- a/dlls/kernel32/thread.c +++ b/dlls/kernel32/thread.c @@ -860,3 +860,23 @@ BOOL WINAPI GetThreadPreferredUILanguages( DWORD flags, PULONG count, PCZZWSTR b *buffersize = 0; return TRUE; } + +/*********************************************************************** + * CreateThreadpoolCleanupGroup (KERNEL32.@) + */ +PTP_CLEANUP_GROUP WINAPI CreateThreadpoolCleanupGroup( void ) +{ + TP_CLEANUP_GROUP *group; + NTSTATUS status; + + TRACE( "\n" ); + + status = TpAllocCleanupGroup( &group ); + if (status) + { + SetLastError( RtlNtStatusToDosError(status) ); + return NULL; + } + + return group; +} diff --git a/include/winternl.h b/include/winternl.h index a84c6d4..c918e09 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2616,6 +2616,12 @@ NTSYSAPI LONGLONG WINAPI RtlLargeIntegerSubtract(LONGLONG,LONGLONG); NTSYSAPI NTSTATUS WINAPI RtlLargeIntegerToChar(const ULONGLONG *,ULONG,ULONG,PCHAR); #endif +/* Threadpool functions */ + +NTSYSAPI NTSTATUS WINAPI TpAllocCleanupGroup(TP_CLEANUP_GROUP **); +NTSYSAPI void WINAPI TpReleaseCleanupGroup(TP_CLEANUP_GROUP *); +NTSYSAPI void WINAPI TpReleaseCleanupGroupMembers(TP_CLEANUP_GROUP *,BOOL,PVOID); + /* Wine internal functions */ NTSYSAPI NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
1
0
0
0
Sebastian Lackner : ntdll/tests: Add tests for threadpool timer merging.
by Alexandre Julliard
03 Jul '15
03 Jul '15
Module: wine Branch: master Commit: 9f71015a994a18656b2c0093bd3f525e959460d3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9f71015a994a18656b2c0093b…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Fri Jul 3 01:59:02 2015 +0200 ntdll/tests: Add tests for threadpool timer merging. --- dlls/ntdll/tests/threadpool.c | 117 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/dlls/ntdll/tests/threadpool.c b/dlls/ntdll/tests/threadpool.c index 460e85e..0671202 100644 --- a/dlls/ntdll/tests/threadpool.c +++ b/dlls/ntdll/tests/threadpool.c @@ -790,6 +790,122 @@ static void test_tp_timer(void) CloseHandle(semaphore); } +struct window_length_info +{ + HANDLE semaphore; + DWORD ticks; +}; + +static void CALLBACK window_length_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_TIMER *timer) +{ + struct window_length_info *info = userdata; + trace("Running window length callback\n"); + info->ticks = GetTickCount(); + ReleaseSemaphore(info->semaphore, 1, NULL); +} + +static void test_tp_window_length(void) +{ + struct window_length_info info1, info2; + TP_CALLBACK_ENVIRON environment; + TP_TIMER *timer1, *timer2; + LARGE_INTEGER when; + HANDLE semaphore; + NTSTATUS status; + TP_POOL *pool; + DWORD result; + + semaphore = CreateSemaphoreA(NULL, 0, 2, NULL); + ok(semaphore != NULL, "CreateSemaphoreA failed %u\n", GetLastError()); + + /* allocate new threadpool */ + pool = NULL; + status = pTpAllocPool(&pool, NULL); + ok(!status, "TpAllocPool failed with status %x\n", status); + ok(pool != NULL, "expected pool != NULL\n"); + + /* allocate two identical timers */ + memset(&environment, 0, sizeof(environment)); + environment.Version = 1; + environment.Pool = pool; + + timer1 = NULL; + info1.semaphore = semaphore; + status = pTpAllocTimer(&timer1, window_length_cb, &info1, &environment); + ok(!status, "TpAllocTimer failed with status %x\n", status); + ok(timer1 != NULL, "expected timer1 != NULL\n"); + + timer2 = NULL; + info2.semaphore = semaphore; + status = pTpAllocTimer(&timer2, window_length_cb, &info2, &environment); + ok(!status, "TpAllocTimer failed with status %x\n", status); + ok(timer2 != NULL, "expected timer2 != NULL\n"); + + /* choose parameters so that timers are not merged */ + info1.ticks = 0; + info2.ticks = 0; + + NtQuerySystemTime( &when ); + when.QuadPart += (ULONGLONG)250 * 10000; + pTpSetTimer(timer2, &when, 0, 0); + Sleep(50); + when.QuadPart -= (ULONGLONG)150 * 10000; + pTpSetTimer(timer1, &when, 0, 75); + + result = WaitForSingleObject(semaphore, 1000); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + result = WaitForSingleObject(semaphore, 1000); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + ok(info1.ticks != 0 && info2.ticks != 0, "expected that ticks are nonzero\n"); + ok(info2.ticks >= info1.ticks + 75 || broken(info2.ticks < info1.ticks + 75) /* Win 2008 */, + "expected that timers are not merged\n"); + + /* timers will be merged */ + info1.ticks = 0; + info2.ticks = 0; + + NtQuerySystemTime( &when ); + when.QuadPart += (ULONGLONG)250 * 10000; + pTpSetTimer(timer2, &when, 0, 0); + Sleep(50); + when.QuadPart -= (ULONGLONG)150 * 10000; + pTpSetTimer(timer1, &when, 0, 200); + + result = WaitForSingleObject(semaphore, 1000); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + result = WaitForSingleObject(semaphore, 1000); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + ok(info1.ticks != 0 && info2.ticks != 0, "expected that ticks are nonzero\n"); + ok(info2.ticks >= info1.ticks - 50 && info2.ticks <= info1.ticks + 50, + "expected that timers are merged\n"); + + /* on Windows the timers also get merged in this case */ + info1.ticks = 0; + info2.ticks = 0; + + NtQuerySystemTime( &when ); + when.QuadPart += (ULONGLONG)100 * 10000; + pTpSetTimer(timer1, &when, 0, 200); + Sleep(50); + when.QuadPart += (ULONGLONG)150 * 10000; + pTpSetTimer(timer2, &when, 0, 0); + + result = WaitForSingleObject(semaphore, 1000); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + result = WaitForSingleObject(semaphore, 1000); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + ok(info1.ticks != 0 && info2.ticks != 0, "expected that ticks are nonzero\n"); + todo_wine + ok(info2.ticks >= info1.ticks - 50 && info2.ticks <= info1.ticks + 50, + "expected that timers are merged\n"); + + /* cleanup */ + pTpReleaseTimer(timer1); + pTpReleaseTimer(timer2); + pTpReleasePool(pool); + CloseHandle(semaphore); +} + START_TEST(threadpool) { if (!init_threadpool()) @@ -802,4 +918,5 @@ START_TEST(threadpool) test_tp_instance(); test_tp_disassociate(); test_tp_timer(); + test_tp_window_length(); }
1
0
0
0
Sebastian Lackner : ntdll/tests: Add basic tests for threadpool timer functions.
by Alexandre Julliard
03 Jul '15
03 Jul '15
Module: wine Branch: master Commit: aefb85ddab60045666d9de3ebe523a24fa83ea42 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=aefb85ddab60045666d9de3eb…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Fri Jul 3 01:58:45 2015 +0200 ntdll/tests: Add basic tests for threadpool timer functions. --- dlls/ntdll/tests/threadpool.c | 145 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) diff --git a/dlls/ntdll/tests/threadpool.c b/dlls/ntdll/tests/threadpool.c index a75b622..460e85e 100644 --- a/dlls/ntdll/tests/threadpool.c +++ b/dlls/ntdll/tests/threadpool.c @@ -23,17 +23,22 @@ static HMODULE hntdll = 0; static NTSTATUS (WINAPI *pTpAllocCleanupGroup)(TP_CLEANUP_GROUP **); static NTSTATUS (WINAPI *pTpAllocPool)(TP_POOL **,PVOID); +static NTSTATUS (WINAPI *pTpAllocTimer)(TP_TIMER **,PTP_TIMER_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); static NTSTATUS (WINAPI *pTpAllocWork)(TP_WORK **,PTP_WORK_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); static NTSTATUS (WINAPI *pTpCallbackMayRunLong)(TP_CALLBACK_INSTANCE *); static VOID (WINAPI *pTpCallbackReleaseSemaphoreOnCompletion)(TP_CALLBACK_INSTANCE *,HANDLE,DWORD); static VOID (WINAPI *pTpDisassociateCallback)(TP_CALLBACK_INSTANCE *); +static BOOL (WINAPI *pTpIsTimerSet)(TP_TIMER *); static VOID (WINAPI *pTpPostWork)(TP_WORK *); static VOID (WINAPI *pTpReleaseCleanupGroup)(TP_CLEANUP_GROUP *); static VOID (WINAPI *pTpReleaseCleanupGroupMembers)(TP_CLEANUP_GROUP *,BOOL,PVOID); static VOID (WINAPI *pTpReleasePool)(TP_POOL *); +static VOID (WINAPI *pTpReleaseTimer)(TP_TIMER *); static VOID (WINAPI *pTpReleaseWork)(TP_WORK *); static VOID (WINAPI *pTpSetPoolMaxThreads)(TP_POOL *,DWORD); +static VOID (WINAPI *pTpSetTimer)(TP_TIMER *,LARGE_INTEGER *,LONG,LONG); static NTSTATUS (WINAPI *pTpSimpleTryPost)(PTP_SIMPLE_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); +static VOID (WINAPI *pTpWaitForTimer)(TP_TIMER *,BOOL); static VOID (WINAPI *pTpWaitForWork)(TP_WORK *,BOOL); #define NTDLL_GET_PROC(func) \ @@ -55,17 +60,22 @@ static BOOL init_threadpool(void) NTDLL_GET_PROC(TpAllocCleanupGroup); NTDLL_GET_PROC(TpAllocPool); + NTDLL_GET_PROC(TpAllocTimer); NTDLL_GET_PROC(TpAllocWork); NTDLL_GET_PROC(TpCallbackMayRunLong); NTDLL_GET_PROC(TpCallbackReleaseSemaphoreOnCompletion); NTDLL_GET_PROC(TpDisassociateCallback); + NTDLL_GET_PROC(TpIsTimerSet); NTDLL_GET_PROC(TpPostWork); NTDLL_GET_PROC(TpReleaseCleanupGroup); NTDLL_GET_PROC(TpReleaseCleanupGroupMembers); NTDLL_GET_PROC(TpReleasePool); + NTDLL_GET_PROC(TpReleaseTimer); NTDLL_GET_PROC(TpReleaseWork); NTDLL_GET_PROC(TpSetPoolMaxThreads); + NTDLL_GET_PROC(TpSetTimer); NTDLL_GET_PROC(TpSimpleTryPost); + NTDLL_GET_PROC(TpWaitForTimer); NTDLL_GET_PROC(TpWaitForWork); if (!pTpAllocPool) @@ -646,6 +656,140 @@ static void test_tp_disassociate(void) CloseHandle(semaphores[1]); } +static void CALLBACK timer_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_TIMER *timer) +{ + HANDLE semaphore = userdata; + trace("Running timer callback\n"); + ReleaseSemaphore(semaphore, 1, NULL); +} + +static void test_tp_timer(void) +{ + TP_CALLBACK_ENVIRON environment; + DWORD result, ticks; + LARGE_INTEGER when; + HANDLE semaphore; + NTSTATUS status; + TP_TIMER *timer; + TP_POOL *pool; + BOOL success; + int i; + + semaphore = CreateSemaphoreA(NULL, 0, 1, NULL); + ok(semaphore != NULL, "CreateSemaphoreA failed %u\n", GetLastError()); + + /* allocate new threadpool */ + pool = NULL; + status = pTpAllocPool(&pool, NULL); + ok(!status, "TpAllocPool failed with status %x\n", status); + ok(pool != NULL, "expected pool != NULL\n"); + + /* allocate new timer */ + timer = NULL; + memset(&environment, 0, sizeof(environment)); + environment.Version = 1; + environment.Pool = pool; + status = pTpAllocTimer(&timer, timer_cb, semaphore, &environment); + ok(!status, "TpAllocTimer failed with status %x\n", status); + ok(timer != NULL, "expected timer != NULL\n"); + + success = pTpIsTimerSet(timer); + ok(!success, "TpIsTimerSet returned TRUE\n"); + + /* test timer with a relative timeout */ + when.QuadPart = (ULONGLONG)200 * -10000; + pTpSetTimer(timer, &when, 0, 0); + success = pTpIsTimerSet(timer); + ok(success, "TpIsTimerSet returned FALSE\n"); + + pTpWaitForTimer(timer, FALSE); + + result = WaitForSingleObject(semaphore, 100); + ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result); + result = WaitForSingleObject(semaphore, 200); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + success = pTpIsTimerSet(timer); + ok(success, "TpIsTimerSet returned FALSE\n"); + + /* test timer with an absolute timeout */ + NtQuerySystemTime( &when ); + when.QuadPart += (ULONGLONG)200 * 10000; + pTpSetTimer(timer, &when, 0, 0); + success = pTpIsTimerSet(timer); + ok(success, "TpIsTimerSet returned FALSE\n"); + + pTpWaitForTimer(timer, FALSE); + + result = WaitForSingleObject(semaphore, 100); + ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result); + result = WaitForSingleObject(semaphore, 200); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + success = pTpIsTimerSet(timer); + ok(success, "TpIsTimerSet returned FALSE\n"); + + /* test timer with zero timeout */ + when.QuadPart = 0; + pTpSetTimer(timer, &when, 0, 0); + success = pTpIsTimerSet(timer); + ok(success, "TpIsTimerSet returned FALSE\n"); + + pTpWaitForTimer(timer, FALSE); + + result = WaitForSingleObject(semaphore, 50); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + success = pTpIsTimerSet(timer); + ok(success, "TpIsTimerSet returned FALSE\n"); + + /* unset the timer */ + pTpSetTimer(timer, NULL, 0, 0); + success = pTpIsTimerSet(timer); + ok(!success, "TpIsTimerSet returned TRUE\n"); + pTpWaitForTimer(timer, TRUE); + + pTpReleaseTimer(timer); + CloseHandle(semaphore); + + semaphore = CreateSemaphoreA(NULL, 0, 3, NULL); + ok(semaphore != NULL, "CreateSemaphoreA failed %u\n", GetLastError()); + + /* allocate a new timer */ + timer = NULL; + memset(&environment, 0, sizeof(environment)); + environment.Version = 1; + environment.Pool = pool; + status = pTpAllocTimer(&timer, timer_cb, semaphore, &environment); + ok(!status, "TpAllocTimer failed with status %x\n", status); + ok(timer != NULL, "expected timer != NULL\n"); + + /* test a relative timeout repeated periodically */ + when.QuadPart = (ULONGLONG)200 * -10000; + pTpSetTimer(timer, &when, 200, 0); + success = pTpIsTimerSet(timer); + ok(success, "TpIsTimerSet returned FALSE\n"); + + /* wait until the timer was triggered three times */ + ticks = GetTickCount(); + for (i = 0; i < 3; i++) + { + result = WaitForSingleObject(semaphore, 1000); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + } + ticks = GetTickCount() - ticks; + ok(ticks >= 500 && (ticks <= 700 || broken(ticks <= 750)) /* Win 7 */, + "expected approximately 600 ticks, got %u\n", ticks); + + /* unset the timer */ + pTpSetTimer(timer, NULL, 0, 0); + success = pTpIsTimerSet(timer); + ok(!success, "TpIsTimerSet returned TRUE\n"); + pTpWaitForTimer(timer, TRUE); + + /* cleanup */ + pTpReleaseTimer(timer); + pTpReleasePool(pool); + CloseHandle(semaphore); +} + START_TEST(threadpool) { if (!init_threadpool()) @@ -657,4 +801,5 @@ START_TEST(threadpool) test_tp_group_cancel(); test_tp_instance(); test_tp_disassociate(); + test_tp_timer(); }
1
0
0
0
← Newer
1
...
45
46
47
48
49
50
51
...
57
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Results per page:
10
25
50
100
200