From: Daniel Lehman dlehman25@gmail.com
--- dlls/msvcp140/tests/msvcp140.c | 21 ++++++++++++++++++++- dlls/msvcp90/misc.c | 6 ++++++ 2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/dlls/msvcp140/tests/msvcp140.c b/dlls/msvcp140/tests/msvcp140.c index 0688239a1fc..a2ca538c245 100644 --- a/dlls/msvcp140/tests/msvcp140.c +++ b/dlls/msvcp140/tests/msvcp140.c @@ -179,7 +179,10 @@ typedef struct { DWORD count; } *_Mtx_t;
-typedef void *_Cnd_t; +typedef struct { + ULONG_PTR unknown; + CONDITION_VARIABLE cv; +} *_Cnd_t;
typedef struct { __time64_t sec; @@ -1556,15 +1559,21 @@ static void test_cnd(void) cm.cnd = cnd; cm.mtx = mtx; cm.timed_wait = FALSE; + ok(cnd->cv.Ptr == 0, "cnd.cv = %p\n", cnd->cv.Ptr); p__Thrd_create(&threads[0], cnd_wait_thread, (void*)&cm);
WaitForSingleObject(cm.initialized, INFINITE); p__Mtx_lock(mtx); p__Mtx_unlock(mtx);
+ todo_wine + ok(cnd->cv.Ptr != 0, "cnd.cv = %p\n", cnd->cv.Ptr); + r = p__Cnd_signal(cm.cnd); ok(!r, "failed to signal\n"); p__Thrd_join(threads[0], NULL); + todo_wine + ok(cnd->cv.Ptr == 0, "cnd.cv = %p\n", cnd->cv.Ptr);
/* test _Cnd_timedwait time out */ p__Mtx_lock(mtx); @@ -1584,20 +1593,27 @@ static void test_cnd(void) /* test _Cnd_timedwait */ cm.started = 0; cm.timed_wait = TRUE; + todo_wine + ok(cnd->cv.Ptr == 0, "cnd.cv = %p\n", cnd->cv.Ptr); p__Thrd_create(&threads[0], cnd_wait_thread, (void*)&cm);
WaitForSingleObject(cm.initialized, INFINITE); p__Mtx_lock(mtx); p__Mtx_unlock(mtx);
+ ok(cnd->cv.Ptr != 0, "cnd.cv = %p\n", cnd->cv.Ptr); r = p__Cnd_signal(cm.cnd); ok(!r, "failed to signal\n"); p__Thrd_join(threads[0], NULL); + todo_wine + ok(cnd->cv.Ptr == 0, "cnd.cv = %p\n", cnd->cv.Ptr);
/* test _Cnd_broadcast */ cm.started = 0; cm.thread_no = NUM_THREADS;
+ todo_wine + ok(cnd->cv.Ptr == 0, "cnd.cv = %p\n", cnd->cv.Ptr); for(i = 0; i < cm.thread_no; i++) p__Thrd_create(&threads[i], cnd_wait_thread, (void*)&cm);
@@ -1605,10 +1621,13 @@ static void test_cnd(void) p__Mtx_lock(mtx); p__Mtx_unlock(mtx);
+ ok(cnd->cv.Ptr != 0, "cnd.cv = %p\n", cnd->cv.Ptr); r = p__Cnd_broadcast(cnd); ok(!r, "failed to broadcast\n"); for(i = 0; i < cm.thread_no; i++) p__Thrd_join(threads[i], NULL); + todo_wine + ok(cnd->cv.Ptr == 0, "cnd.cv = %p\n", cnd->cv.Ptr);
p__Cnd_destroy(cnd); p__Mtx_destroy(mtx); diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c index 088ecc9976c..80256c1f357 100644 --- a/dlls/msvcp90/misc.c +++ b/dlls/msvcp90/misc.c @@ -832,6 +832,9 @@ void __cdecl _Mtx_reset_owner(_Mtx_arg_t mtx)
typedef struct { +#if _MSVCP_VER >= 140 + ULONG_PTR unknown; +#endif cv cv; } *_Cnd_t;
@@ -847,6 +850,9 @@ typedef _Cnd_t *_Cnd_arg_t;
void __cdecl _Cnd_init_in_situ(_Cnd_t cnd) { +#if _MSVCP_VER >= 140 + cnd->unknown = 0; +#endif cv_init(&cnd->cv); }