wine/dlls/kernel/tests thread.c
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Nov 18 09:06:38 CST 2005
ChangeSet ID: 21337
CVSROOT: /opt/cvs-commit
Module name: wine
Changes by: julliard at winehq.org 2005/11/18 09:06:38
Modified files:
dlls/kernel/tests: thread.c
Log message:
Avoid setting the context before the thread has started running, it's
broken on most Windows versions.
Patch: http://cvs.winehq.org/patch.py?id=21337
Old revision New revision Changes Path
1.32 1.33 +8 -1 wine/dlls/kernel/tests/thread.c
Index: wine/dlls/kernel/tests/thread.c
diff -u -p wine/dlls/kernel/tests/thread.c:1.32 wine/dlls/kernel/tests/thread.c:1.33
--- wine/dlls/kernel/tests/thread.c:1.32 18 Nov 2005 15: 6:38 -0000
+++ wine/dlls/kernel/tests/thread.c 18 Nov 2005 15: 6:38 -0000
@@ -610,6 +610,7 @@ static VOID test_GetThreadExitCode(void)
#ifdef __i386__
static int test_value = 0;
+static HANDLE event;
static void WINAPI set_test_val( int val )
{
@@ -618,6 +619,8 @@ static void WINAPI set_test_val( int val
static DWORD WINAPI threadFunc6(LPVOID p)
{
+ SetEvent( event );
+ Sleep( 1000 );
test_value *= (int)p;
return 0;
}
@@ -631,13 +634,17 @@ static void test_SetThreadContext(void)
DWORD prevcount;
SetLastError(0xdeadbeef);
- thread = CreateThread( NULL, 0, threadFunc6, (void *)2, CREATE_SUSPENDED, &threadid );
+ event = CreateEvent( NULL, TRUE, FALSE, NULL );
+ thread = CreateThread( NULL, 0, threadFunc6, (void *)2, 0, &threadid );
ok( thread != NULL, "CreateThread failed : (%ld)\n", GetLastError() );
if (!thread)
{
trace("Thread creation failed, skipping rest of test\n");
return;
}
+ WaitForSingleObject( event, INFINITE );
+ SuspendThread( thread );
+ CloseHandle( event );
ctx.ContextFlags = CONTEXT_FULL;
SetLastError(0xdeadbeef);
More information about the wine-cvs
mailing list