Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/comsvcs/tests/dispenser.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/dlls/comsvcs/tests/dispenser.c b/dlls/comsvcs/tests/dispenser.c index 98d2a91bf5..7e873c1cf8 100644 --- a/dlls/comsvcs/tests/dispenser.c +++ b/dlls/comsvcs/tests/dispenser.c @@ -165,6 +165,7 @@ static void create_dispenser(void) RESID resid; DWORD ret; BSTR str; + int i;
hr = CoCreateInstance( &CLSID_DispenserManager, NULL, CLSCTX_ALL, &IID_IDispenserManager, (void**)&dispenser); ok(hr == S_OK, "Failed to create object 0x%08x\n", hr); @@ -184,10 +185,14 @@ static void create_dispenser(void)
/* The above call creates an MTA thread, but we need to wait for it to * actually initialize. */ - Sleep(200); - thread = CreateThread(NULL, 0, com_thread, NULL, 0, NULL); - ok(!WaitForSingleObject(thread, 1000), "wait failed\n"); - GetExitCodeThread(thread, &ret); + for (i = 1; i < 10; ++i) + { + thread = CreateThread(NULL, 0, com_thread, NULL, 0, NULL); + ok(!WaitForSingleObject(thread, 1000), "wait failed\n"); + GetExitCodeThread(thread, &ret); + if (ret != CO_E_NOTINITIALIZED) break; + Sleep(100 * i); + } ok(ret == S_OK, "got unexpected hr %#x\n", ret);
hr = IDispenserManager_RegisterDispenser(dispenser, &DispenserDriver, pool0, &holder2);