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
Sebastian Lackner : ntdll/tests: Add basic tests for threadpool work items.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 17cd2a8b241889bcf842150990142825c4899f25 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=17cd2a8b241889bcf84215099…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Wed Jul 1 02:58:26 2015 +0200 ntdll/tests: Add basic tests for threadpool work items. --- dlls/ntdll/tests/threadpool.c | 59 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/dlls/ntdll/tests/threadpool.c b/dlls/ntdll/tests/threadpool.c index 4bab5d3..46857b7 100644 --- a/dlls/ntdll/tests/threadpool.c +++ b/dlls/ntdll/tests/threadpool.c @@ -23,10 +23,14 @@ static HMODULE hntdll = 0; static NTSTATUS (WINAPI *pTpAllocCleanupGroup)(TP_CLEANUP_GROUP **); static NTSTATUS (WINAPI *pTpAllocPool)(TP_POOL **,PVOID); +static NTSTATUS (WINAPI *pTpAllocWork)(TP_WORK **,PTP_WORK_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); +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 *pTpReleaseWork)(TP_WORK *); static NTSTATUS (WINAPI *pTpSimpleTryPost)(PTP_SIMPLE_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); +static VOID (WINAPI *pTpWaitForWork)(TP_WORK *,BOOL); #define NTDLL_GET_PROC(func) \ do \ @@ -47,10 +51,14 @@ static BOOL init_threadpool(void) NTDLL_GET_PROC(TpAllocCleanupGroup); NTDLL_GET_PROC(TpAllocPool); + NTDLL_GET_PROC(TpAllocWork); + NTDLL_GET_PROC(TpPostWork); NTDLL_GET_PROC(TpReleaseCleanupGroup); NTDLL_GET_PROC(TpReleaseCleanupGroupMembers); NTDLL_GET_PROC(TpReleasePool); + NTDLL_GET_PROC(TpReleaseWork); NTDLL_GET_PROC(TpSimpleTryPost); + NTDLL_GET_PROC(TpWaitForWork); if (!pTpAllocPool) { @@ -167,10 +175,61 @@ static void test_tp_simple(void) CloseHandle(semaphore); } +static void CALLBACK work_cb(TP_CALLBACK_INSTANCE *instance, void *userdata, TP_WORK *work) +{ + trace("Running work callback\n"); + Sleep(10); + InterlockedIncrement((LONG *)userdata); +} + +static void test_tp_work(void) +{ + TP_CALLBACK_ENVIRON environment; + TP_WORK *work; + TP_POOL *pool; + NTSTATUS status; + LONG userdata; + int i; + + /* 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 work item */ + work = NULL; + memset(&environment, 0, sizeof(environment)); + environment.Version = 1; + environment.Pool = pool; + status = pTpAllocWork(&work, work_cb, &userdata, &environment); + ok(!status, "TpAllocWork failed with status %x\n", status); + ok(work != NULL, "expected work != NULL\n"); + + /* post 10 identical work items at once */ + userdata = 0; + for (i = 0; i < 10; i++) + pTpPostWork(work); + pTpWaitForWork(work, FALSE); + ok(userdata == 10, "expected userdata = 10, got %u\n", userdata); + + /* add more tasks and cancel them immediately */ + userdata = 0; + for (i = 0; i < 10; i++) + pTpPostWork(work); + pTpWaitForWork(work, TRUE); + ok(userdata < 10, "expected userdata < 10, got %u\n", userdata); + + /* cleanup */ + pTpReleaseWork(work); + pTpReleasePool(pool); +} + START_TEST(threadpool) { if (!init_threadpool()) return; test_tp_simple(); + test_tp_work(); }
1
0
0
0
Sebastian Lackner : ntdll: Implement threadpool work item functions.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: e4c38f6bad3df50c71eb9b05a03d38732a854de3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e4c38f6bad3df50c71eb9b05a…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Wed Jul 1 02:57:57 2015 +0200 ntdll: Implement threadpool work item functions. --- dlls/ntdll/ntdll.spec | 4 +++ dlls/ntdll/threadpool.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 96 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index f889b04..4b5ece5 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -972,12 +972,16 @@ @ stdcall RtlxUnicodeStringToOemSize(ptr) RtlUnicodeStringToOemSize @ stdcall TpAllocCleanupGroup(ptr) @ stdcall TpAllocPool(ptr ptr) +@ stdcall TpAllocWork(ptr ptr ptr ptr) +@ stdcall TpPostWork(ptr) @ stdcall TpReleaseCleanupGroup(ptr) @ stdcall TpReleaseCleanupGroupMembers(ptr long ptr) @ stdcall TpReleasePool(ptr) +@ stdcall TpReleaseWork(ptr) @ stdcall TpSetPoolMaxThreads(ptr long) @ stdcall TpSetPoolMinThreads(ptr long) @ stdcall TpSimpleTryPost(ptr ptr ptr) +@ stdcall TpWaitForWork(ptr long) @ stdcall -ret64 VerSetConditionMask(int64 long long) @ stdcall WinSqmIsOptedIn() @ stdcall ZwAcceptConnectPort(ptr long ptr long long ptr) NtAcceptConnectPort diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c index 2e8568c..da41ba0 100644 --- a/dlls/ntdll/threadpool.c +++ b/dlls/ntdll/threadpool.c @@ -157,7 +157,8 @@ struct threadpool enum threadpool_objtype { - TP_OBJECT_TYPE_SIMPLE + TP_OBJECT_TYPE_SIMPLE, + TP_OBJECT_TYPE_WORK }; /* internal threadpool object representation */ @@ -185,6 +186,10 @@ struct threadpool_object { PTP_SIMPLE_CALLBACK callback; } simple; + struct + { + PTP_WORK_CALLBACK callback; + } work; } u; }; @@ -203,6 +208,13 @@ static inline struct threadpool *impl_from_TP_POOL( TP_POOL *pool ) return (struct threadpool *)pool; } +static inline struct threadpool_object *impl_from_TP_WORK( TP_WORK *work ) +{ + struct threadpool_object *object = (struct threadpool_object *)work; + assert( object->type == TP_OBJECT_TYPE_WORK ); + return object; +} + static inline struct threadpool_group *impl_from_TP_CLEANUP_GROUP( TP_CLEANUP_GROUP *group ) { return (struct threadpool_group *)group; @@ -1579,6 +1591,15 @@ static void CALLBACK threadpool_worker_proc( void *param ) break; } + case TP_OBJECT_TYPE_WORK: + { + TRACE( "executing work callback %p(NULL, %p, %p)\n", + object->u.work.callback, object->userdata, object ); + object->u.work.callback( NULL, object->userdata, (TP_WORK *)object ); + TRACE( "callback %p returned\n", object->u.work.callback ); + break; + } + default: assert(0); break; @@ -1641,6 +1662,49 @@ NTSTATUS WINAPI TpAllocPool( TP_POOL **out, PVOID reserved ) } /*********************************************************************** + * TpAllocWork (NTDLL.@) + */ +NTSTATUS WINAPI TpAllocWork( TP_WORK **out, PTP_WORK_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_WORK; + object->u.work.callback = callback; + tp_object_initialize( object, pool, userdata, environment ); + + *out = (TP_WORK *)object; + return STATUS_SUCCESS; +} + +/*********************************************************************** + * TpPostWork (NTDLL.@) + */ +VOID WINAPI TpPostWork( TP_WORK *work ) +{ + struct threadpool_object *this = impl_from_TP_WORK( work ); + + TRACE( "%p\n", work ); + + tp_object_submit( this ); +} + +/*********************************************************************** * TpReleaseCleanupGroup (NTDLL.@) */ VOID WINAPI TpReleaseCleanupGroup( TP_CLEANUP_GROUP *group ) @@ -1728,6 +1792,19 @@ VOID WINAPI TpReleasePool( TP_POOL *pool ) } /*********************************************************************** + * TpReleaseWork (NTDLL.@) + */ +VOID WINAPI TpReleaseWork( TP_WORK *work ) +{ + struct threadpool_object *this = impl_from_TP_WORK( work ); + + TRACE( "%p\n", work ); + + tp_object_shutdown( this ); + tp_object_release( this ); +} + +/*********************************************************************** * TpSetPoolMaxThreads (NTDLL.@) */ VOID WINAPI TpSetPoolMaxThreads( TP_POOL *pool, DWORD maximum ) @@ -1806,3 +1883,17 @@ NTSTATUS WINAPI TpSimpleTryPost( PTP_SIMPLE_CALLBACK callback, PVOID userdata, return STATUS_SUCCESS; } + +/*********************************************************************** + * TpWaitForWork (NTDLL.@) + */ +VOID WINAPI TpWaitForWork( TP_WORK *work, BOOL cancel_pending ) +{ + struct threadpool_object *this = impl_from_TP_WORK( work ); + + TRACE( "%p %u\n", work, cancel_pending ); + + if (cancel_pending) + tp_object_cancel( this ); + tp_object_wait( this ); +}
1
0
0
0
Sebastian Lackner : ntdll/tests: Add tests for TpAllocCleanupGroup and related functions.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 3606b47139d80fb480345a64cd49564ac43a3aae URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3606b47139d80fb480345a64c…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Wed Jul 1 02:57:32 2015 +0200 ntdll/tests: Add tests for TpAllocCleanupGroup and related functions. --- dlls/ntdll/tests/threadpool.c | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/dlls/ntdll/tests/threadpool.c b/dlls/ntdll/tests/threadpool.c index 6f164e9..4bab5d3 100644 --- a/dlls/ntdll/tests/threadpool.c +++ b/dlls/ntdll/tests/threadpool.c @@ -21,7 +21,10 @@ #include "ntdll_test.h" static HMODULE hntdll = 0; +static NTSTATUS (WINAPI *pTpAllocCleanupGroup)(TP_CLEANUP_GROUP **); static NTSTATUS (WINAPI *pTpAllocPool)(TP_POOL **,PVOID); +static VOID (WINAPI *pTpReleaseCleanupGroup)(TP_CLEANUP_GROUP *); +static VOID (WINAPI *pTpReleaseCleanupGroupMembers)(TP_CLEANUP_GROUP *,BOOL,PVOID); static VOID (WINAPI *pTpReleasePool)(TP_POOL *); static NTSTATUS (WINAPI *pTpSimpleTryPost)(PTP_SIMPLE_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *); @@ -42,7 +45,10 @@ static BOOL init_threadpool(void) return FALSE; } + NTDLL_GET_PROC(TpAllocCleanupGroup); NTDLL_GET_PROC(TpAllocPool); + NTDLL_GET_PROC(TpReleaseCleanupGroup); + NTDLL_GET_PROC(TpReleaseCleanupGroupMembers); NTDLL_GET_PROC(TpReleasePool); NTDLL_GET_PROC(TpSimpleTryPost); @@ -65,13 +71,23 @@ static void CALLBACK simple_cb(TP_CALLBACK_INSTANCE *instance, void *userdata) ReleaseSemaphore(semaphore, 1, NULL); } +static void CALLBACK simple2_cb(TP_CALLBACK_INSTANCE *instance, void *userdata) +{ + trace("Running simple2 callback\n"); + Sleep(50); + InterlockedIncrement((LONG *)userdata); +} + static void test_tp_simple(void) { TP_CALLBACK_ENVIRON environment; + TP_CLEANUP_GROUP *group; HANDLE semaphore; NTSTATUS status; TP_POOL *pool; + LONG userdata; DWORD result; + int i; semaphore = CreateSemaphoreA(NULL, 0, 1, NULL); ok(semaphore != NULL, "CreateSemaphoreA failed %u\n", GetLastError()); @@ -114,7 +130,39 @@ static void test_tp_simple(void) ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); } + /* allocate a cleanup group for synchronization */ + group = NULL; + status = pTpAllocCleanupGroup(&group); + ok(!status, "TpAllocCleanupGroup failed with status %x\n", status); + ok(group != NULL, "expected pool != NULL\n"); + + /* use cleanup group to wait for a simple callback */ + userdata = 0; + memset(&environment, 0, sizeof(environment)); + environment.Version = 1; + environment.Pool = pool; + environment.CleanupGroup = group; + status = pTpSimpleTryPost(simple2_cb, &userdata, &environment); + ok(!status, "TpSimpleTryPost failed with status %x\n", status); + pTpReleaseCleanupGroupMembers(group, FALSE, NULL); + ok(userdata == 1, "expected userdata = 1, got %u\n", userdata); + + /* test cancellation of pending simple callbacks */ + userdata = 0; + memset(&environment, 0, sizeof(environment)); + environment.Version = 1; + environment.Pool = pool; + environment.CleanupGroup = group; + for (i = 0; i < 100; i++) + { + status = pTpSimpleTryPost(simple2_cb, &userdata, &environment); + ok(!status, "TpSimpleTryPost failed with status %x\n", status); + } + pTpReleaseCleanupGroupMembers(group, TRUE, NULL); + ok(userdata < 100, "expected userdata < 100, got %u\n", userdata); + /* cleanup */ + pTpReleaseCleanupGroup(group); pTpReleasePool(pool); CloseHandle(semaphore); }
1
0
0
0
Sebastian Lackner : ntdll: Implement threadpool cleanup group functions.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 68d92bceeda212252135a95dbafa4aa7aaf1c108 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=68d92bceeda212252135a95db…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Wed Jul 1 02:57:15 2015 +0200 ntdll: Implement threadpool cleanup group functions. --- dlls/ntdll/ntdll.spec | 3 + dlls/ntdll/threadpool.c | 268 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 266 insertions(+), 5 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=68d92bceeda212252135a…
1
0
0
0
Sebastian Lackner : ntdll: Implement TpSetPoolMinThreads.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: 7d9ec31e19029b726767dafaad25922eb1ad2564 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7d9ec31e19029b726767dafaa…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Wed Jul 1 02:56:26 2015 +0200 ntdll: Implement TpSetPoolMinThreads. --- dlls/ntdll/ntdll.spec | 1 + dlls/ntdll/threadpool.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index f023443..94194d6 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -973,6 +973,7 @@ @ stdcall TpAllocPool(ptr ptr) @ stdcall TpReleasePool(ptr) @ stdcall TpSetPoolMaxThreads(ptr long) +@ stdcall TpSetPoolMinThreads(ptr long) @ stdcall TpSimpleTryPost(ptr ptr ptr) @ stdcall -ret64 VerSetConditionMask(int64 long long) @ stdcall WinSqmIsOptedIn() diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c index 19f288a..6025633 100644 --- a/dlls/ntdll/threadpool.c +++ b/dlls/ntdll/threadpool.c @@ -1481,6 +1481,41 @@ VOID WINAPI TpSetPoolMaxThreads( TP_POOL *pool, DWORD maximum ) } /*********************************************************************** + * TpSetPoolMinThreads (NTDLL.@) + */ +BOOL WINAPI TpSetPoolMinThreads( TP_POOL *pool, DWORD minimum ) +{ + struct threadpool *this = impl_from_TP_POOL( pool ); + NTSTATUS status = STATUS_SUCCESS; + + TRACE( "%p %u\n", pool, minimum ); + + RtlEnterCriticalSection( &this->cs ); + + while (this->num_workers < minimum) + { + HANDLE thread; + status = RtlCreateUserThread( GetCurrentProcess(), NULL, FALSE, NULL, 0, 0, + threadpool_worker_proc, this, &thread, NULL ); + if (status != STATUS_SUCCESS) + break; + + interlocked_inc( &this->refcount ); + this->num_workers++; + NtClose( thread ); + } + + if (status == STATUS_SUCCESS) + { + this->min_workers = minimum; + this->max_workers = max( this->min_workers, this->max_workers ); + } + + RtlLeaveCriticalSection( &this->cs ); + return !status; +} + +/*********************************************************************** * TpSimpleTryPost (NTDLL.@) */ NTSTATUS WINAPI TpSimpleTryPost( PTP_SIMPLE_CALLBACK callback, PVOID userdata,
1
0
0
0
Sebastian Lackner : ntdll: Implement TpSetPoolMaxThreads.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: d56984a03d3a5e8a256ff5a46540478cba01c191 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d56984a03d3a5e8a256ff5a46…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Wed Jul 1 02:55:53 2015 +0200 ntdll: Implement TpSetPoolMaxThreads. --- dlls/ntdll/ntdll.spec | 1 + dlls/ntdll/threadpool.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index cd4e853..f023443 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -972,6 +972,7 @@ @ stdcall RtlxUnicodeStringToOemSize(ptr) RtlUnicodeStringToOemSize @ stdcall TpAllocPool(ptr ptr) @ stdcall TpReleasePool(ptr) +@ stdcall TpSetPoolMaxThreads(ptr long) @ stdcall TpSimpleTryPost(ptr ptr ptr) @ stdcall -ret64 VerSetConditionMask(int64 long long) @ stdcall WinSqmIsOptedIn() diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c index d8dc929..19f288a 100644 --- a/dlls/ntdll/threadpool.c +++ b/dlls/ntdll/threadpool.c @@ -1466,6 +1466,21 @@ VOID WINAPI TpReleasePool( TP_POOL *pool ) } /*********************************************************************** + * TpSetPoolMaxThreads (NTDLL.@) + */ +VOID WINAPI TpSetPoolMaxThreads( TP_POOL *pool, DWORD maximum ) +{ + struct threadpool *this = impl_from_TP_POOL( pool ); + + TRACE( "%p %u\n", pool, maximum ); + + RtlEnterCriticalSection( &this->cs ); + this->max_workers = max( maximum, 1 ); + this->min_workers = min( this->min_workers, this->max_workers ); + RtlLeaveCriticalSection( &this->cs ); +} + +/*********************************************************************** * TpSimpleTryPost (NTDLL.@) */ NTSTATUS WINAPI TpSimpleTryPost( PTP_SIMPLE_CALLBACK callback, PVOID userdata,
1
0
0
0
Sebastian Lackner : ntdll: Implement TpSimpleTryPost and basic threadpool infrastructure.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: db9fc9141e8947a540584fcf4ebde2a84051803d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=db9fc9141e8947a540584fcf4…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Wed Jul 1 02:55:27 2015 +0200 ntdll: Implement TpSimpleTryPost and basic threadpool infrastructure. --- dlls/ntdll/ntdll.spec | 3 + dlls/ntdll/tests/threadpool.c | 3 +- dlls/ntdll/threadpool.c | 454 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 459 insertions(+), 1 deletion(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=db9fc9141e8947a540584…
1
0
0
0
Zhenbo Li : mshtml: Add IHTMLXMLHttpRequest:: readyState property implementation.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: b6cf265317595221081d787bd76a5cc08e43429b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b6cf265317595221081d787bd…
Author: Zhenbo Li <litimetal(a)gmail.com> Date: Tue Jun 30 21:53:20 2015 +0800 mshtml: Add IHTMLXMLHttpRequest::readyState property implementation. --- dlls/mshtml/tests/xmlhttprequest.c | 16 ++++++++-------- dlls/mshtml/xmlhttprequest.c | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/dlls/mshtml/tests/xmlhttprequest.c b/dlls/mshtml/tests/xmlhttprequest.c index 240f6d3..cf5f674 100644 --- a/dlls/mshtml/tests/xmlhttprequest.c +++ b/dlls/mshtml/tests/xmlhttprequest.c @@ -362,12 +362,12 @@ static void test_sync_xhr(IHTMLDocument2 *doc, const char *xml_url) ok(V_DISPATCH(&var) == (IDispatch*)&xmlhttprequest_onreadystatechange_obj, "unexpected onreadystatechange value\n"); hres = IHTMLXMLHttpRequest_get_readyState(xhr, NULL); - todo_wine ok(hres == E_POINTER, "Expect E_POINTER, got %08x\n", hres); + ok(hres == E_POINTER, "Expect E_POINTER, got %08x\n", hres); val = 0xdeadbeef; hres = IHTMLXMLHttpRequest_get_readyState(xhr, &val); - todo_wine ok(hres == S_OK, "get_readyState failed: %08x\n", hres); - todo_wine ok(val == 0, "Expect UNSENT, got %d\n", val); + ok(hres == S_OK, "get_readyState failed: %08x\n", hres); + ok(val == 0, "Expect UNSENT, got %d\n", val); hres = IHTMLXMLHttpRequest_get_status(xhr, NULL); todo_wine ok(hres == E_POINTER, "Expect E_POINTER, got %08x\n", hres); @@ -492,8 +492,8 @@ static void test_async_xhr(IHTMLDocument2 *doc, const char *xml_url) val = 0xdeadbeef; hres = IHTMLXMLHttpRequest_get_readyState(xhr, &val); - todo_wine ok(hres == S_OK, "get_readyState failed: %08x\n", hres); - todo_wine ok(val == 0, "Expect UNSENT, got %d\n", val); + ok(hres == S_OK, "get_readyState failed: %08x\n", hres); + ok(val == 0, "Expect UNSENT, got %d\n", val); method = a2bstr("GET"); url = a2bstr(xml_url); @@ -526,8 +526,8 @@ static void test_async_xhr(IHTMLDocument2 *doc, const char *xml_url) val = 0xdeadbeef; hres = IHTMLXMLHttpRequest_get_readyState(xhr, &val); - todo_wine ok(hres == S_OK, "get_readyState failed: %08x\n", hres); - todo_wine ok(val == 1, "Expect OPENED, got %d\n", val); + ok(hres == S_OK, "get_readyState failed: %08x\n", hres); + ok(val == 1, "Expect OPENED, got %d\n", val); SET_EXPECT(xmlhttprequest_onreadystatechange_opened); SET_EXPECT(xmlhttprequest_onreadystatechange_headers_received); @@ -564,7 +564,7 @@ static void test_async_xhr(IHTMLDocument2 *doc, const char *xml_url) val = 0xdeadbeef; hres = IHTMLXMLHttpRequest_get_readyState(xhr, &val); ok(hres == S_OK, "get_readyState failed: %08x\n", hres); - ok(val == 4, "Expect DONE, got %d\n", val); + todo_wine ok(val == 4, "Expect DONE, got %d\n", val); hres = IHTMLXMLHttpRequest_get_responseText(xhr, &text); ok(hres == S_OK, "get_responseText failed: %08x\n", hres); diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 3953237..6f417a5 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -158,8 +158,20 @@ static HRESULT WINAPI HTMLXMLHttpRequest_Invoke(IHTMLXMLHttpRequest *iface, DISP static HRESULT WINAPI HTMLXMLHttpRequest_get_readyState(IHTMLXMLHttpRequest *iface, LONG *p) { HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + UINT16 val; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + if(!p) + return E_POINTER; + nsres = nsIXMLHttpRequest_GetReadyState(This->nsxhr, &val); + if(NS_FAILED(nsres)) { + ERR("nsIXMLHttpRequest_GetReadyState failed: %08x\n", nsres); + return E_FAIL; + } + *p = val; + return S_OK; } static HRESULT WINAPI HTMLXMLHttpRequest_get_responseBody(IHTMLXMLHttpRequest *iface, VARIANT *p)
1
0
0
0
Zhenbo Li : mshtml: Add IHTMLXMLHttpRequest:open() method implementation.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: d6b92300afd6bf9ce32ac314008cbee2e423836f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d6b92300afd6bf9ce32ac3140…
Author: Zhenbo Li <litimetal(a)gmail.com> Date: Tue Jun 30 21:51:21 2015 +0800 mshtml: Add IHTMLXMLHttpRequest:open() method implementation. --- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/nsembed.c | 2 +- dlls/mshtml/tests/xmlhttprequest.c | 27 +++++++----- dlls/mshtml/xmlhttprequest.c | 87 +++++++++++++++++++++++++++++++++++++- 4 files changed, 104 insertions(+), 13 deletions(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index ca021ba..87e4154 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -855,6 +855,7 @@ HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DE void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN; void nsfree(void*) DECLSPEC_HIDDEN; +BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN; void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN; void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN; UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 962494a..df2e130 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -795,7 +795,7 @@ void nsfree(void *mem) NS_Free(mem); } -static BOOL nsACString_Init(nsACString *str, const char *data) +BOOL nsACString_Init(nsACString *str, const char *data) { return NS_SUCCEEDED(NS_CStringContainerInit2(str, data, PR_UINT32_MAX, 0)); } diff --git a/dlls/mshtml/tests/xmlhttprequest.c b/dlls/mshtml/tests/xmlhttprequest.c index abfba57..240f6d3 100644 --- a/dlls/mshtml/tests/xmlhttprequest.c +++ b/dlls/mshtml/tests/xmlhttprequest.c @@ -503,7 +503,7 @@ static void test_async_xhr(IHTMLDocument2 *doc, const char *xml_url) SET_EXPECT(xmlhttprequest_onreadystatechange_opened); hres = IHTMLXMLHttpRequest_open(xhr, method, url, vbool, vempty, vempty); - todo_wine ok(hres == S_OK, "open failed: %08x\n", hres); + ok(hres == S_OK, "open failed: %08x\n", hres); todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_opened); SysFreeString(method); @@ -517,30 +517,37 @@ static void test_async_xhr(IHTMLDocument2 *doc, const char *xml_url) val = 0xdeadbeef; hres = IHTMLXMLHttpRequest_get_status(xhr, &val); - ok(hres == E_FAIL, "Expect E_FAIL, got: %08x\n", hres); - ok(val == 0, "Expect 0, got %d\n", val); + todo_wine ok(hres == E_FAIL, "Expect E_FAIL, got: %08x\n", hres); + todo_wine ok(val == 0, "Expect 0, got %d\n", val); hres = IHTMLXMLHttpRequest_get_statusText(xhr, &text); - ok(hres == E_FAIL, "Expect E_FAIL, got: %08x\n", hres); - ok(text == NULL, "Expect NULL, got %p\n", text); + todo_wine ok(hres == E_FAIL, "Expect E_FAIL, got: %08x\n", hres); + todo_wine ok(text == NULL, "Expect NULL, got %p\n", text); val = 0xdeadbeef; hres = IHTMLXMLHttpRequest_get_readyState(xhr, &val); - ok(hres == S_OK, "get_readyState failed: %08x\n", hres); - ok(val == 1, "Expect OPENED, got %d\n", val); + todo_wine ok(hres == S_OK, "get_readyState failed: %08x\n", hres); + todo_wine ok(val == 1, "Expect OPENED, got %d\n", val); SET_EXPECT(xmlhttprequest_onreadystatechange_opened); SET_EXPECT(xmlhttprequest_onreadystatechange_headers_received); SET_EXPECT(xmlhttprequest_onreadystatechange_loading); SET_EXPECT(xmlhttprequest_onreadystatechange_done); hres = IHTMLXMLHttpRequest_send(xhr, vempty); - ok(hres == S_OK, "send failed: %08x\n", hres); - pump_msgs(&called_xmlhttprequest_onreadystatechange_done); + todo_wine ok(hres == S_OK, "send failed: %08x\n", hres); + if(SUCCEEDED(hres)) + pump_msgs(&called_xmlhttprequest_onreadystatechange_done); todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_opened); todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_headers_received); todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_loading); - CHECK_CALLED(xmlhttprequest_onreadystatechange_done); + todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_done); + + if(FAILED(hres)) { + IHTMLXMLHttpRequest_Release(xhr); + xhr = NULL; + return; + } val = 0xdeadbeef; hres = IHTMLXMLHttpRequest_get_status(xhr, &val); diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index e79c2fc..3953237 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -33,6 +33,33 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); +static HRESULT bstr_to_nsacstr(BSTR bstr, nsACString *str) +{ + char *cstr = heap_strdupWtoU(bstr); + if(!cstr) + return E_OUTOFMEMORY; + nsACString_Init(str, cstr); + heap_free(cstr); + return S_OK; +} + +static HRESULT variant_to_nsastr(VARIANT var, nsAString *ret) +{ + switch(V_VT(&var)) { + case VT_NULL: + case VT_ERROR: + case VT_EMPTY: + nsAString_Init(ret, NULL); + return S_OK; + case VT_BSTR: + nsAString_InitDepend(ret, V_BSTR(&var)); + return S_OK; + default: + FIXME("Unsupported VARIANT: %s\n", debugstr_variant(&var)); + return E_INVALIDARG; + } +} + /* IHTMLXMLHttpRequest */ typedef struct { EventTarget event_target; @@ -198,8 +225,64 @@ static HRESULT WINAPI HTMLXMLHttpRequest_abort(IHTMLXMLHttpRequest *iface) static HRESULT WINAPI HTMLXMLHttpRequest_open(IHTMLXMLHttpRequest *iface, BSTR bstrMethod, BSTR bstrUrl, VARIANT varAsync, VARIANT varUser, VARIANT varPassword) { HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface); - FIXME("(%p)->(%s %s %s %s %s)\n", This, debugstr_w(bstrMethod), debugstr_w(bstrUrl), debugstr_variant(&varAsync), debugstr_variant(&varUser), debugstr_variant(&varPassword)); - return E_NOTIMPL; + nsACString method, url; + nsAString user, password; + nsresult nsres; + HRESULT hres; + + TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_w(bstrMethod), debugstr_w(bstrUrl), debugstr_variant(&varAsync), debugstr_variant(&varUser), debugstr_variant(&varPassword)); + + if(V_VT(&varAsync) != VT_BOOL) { + FIXME("varAsync not supported: %s\n", debugstr_variant(&varAsync)); + return E_FAIL; + } + + /* Note: Starting with Gecko 30.0 (Firefox 30.0 / Thunderbird 30.0 / SeaMonkey 2.27), + * synchronous requests on the main thread have been deprecated due to the negative + * effects to the user experience. + */ + if(!V_BOOL(&varAsync)) { + FIXME("Synchronous request is not supported yet\n"); + return E_FAIL; + } + + hres = variant_to_nsastr(varUser, &user); + if(FAILED(hres)) + return hres; + hres = variant_to_nsastr(varPassword, &password); + if(FAILED(hres)) { + nsAString_Finish(&user); + return hres; + } + + hres = bstr_to_nsacstr(bstrMethod, &method); + if(FAILED(hres)) { + nsAString_Finish(&user); + nsAString_Finish(&password); + return hres; + } + hres = bstr_to_nsacstr(bstrUrl, &url); + if(FAILED(hres)) { + nsAString_Finish(&user); + nsAString_Finish(&password); + nsACString_Finish(&method); + return hres; + } + + nsres = nsIXMLHttpRequest_Open(This->nsxhr, &method, &url, TRUE, + &user, &password, 0); + + nsACString_Finish(&method); + nsACString_Finish(&url); + nsAString_Finish(&user); + nsAString_Finish(&password); + + if(NS_FAILED(nsres)) { + ERR("nsIXMLHttpRequest_Open failed: %08x\n", nsres); + return E_FAIL; + } + + return S_OK; } static HRESULT WINAPI HTMLXMLHttpRequest_send(IHTMLXMLHttpRequest *iface, VARIANT varBody)
1
0
0
0
Zhenbo Li : mshtml: Add IHTMLXMLHttpRequestFactory::create() method implementation.
by Alexandre Julliard
01 Jul '15
01 Jul '15
Module: wine Branch: master Commit: deb884a6d874b52cfd69e5cdc58c826cdc444603 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=deb884a6d874b52cfd69e5cdc…
Author: Zhenbo Li <litimetal(a)gmail.com> Date: Tue Jun 30 21:50:30 2015 +0800 mshtml: Add IHTMLXMLHttpRequestFactory::create() method implementation. --- dlls/mshtml/htmlwindow.c | 14 ++++---- dlls/mshtml/mshtml_private.h | 5 ++- dlls/mshtml/nsembed.c | 50 ++++++++++++++++++++++++++ dlls/mshtml/nsiface.idl | 85 ++++++++++++++++++++++++++++++++++++++++++++ dlls/mshtml/xmlhttprequest.c | 13 ++++++- 5 files changed, 159 insertions(+), 8 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=deb884a6d874b52cfd69e…
1
0
0
0
← Newer
1
...
53
54
55
56
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