Fix broken thread start routines.

This commit is contained in:
Robert Shearman 2004-11-03 22:18:44 +00:00 committed by Alexandre Julliard
parent 757687ee42
commit 84eaaa168f
4 changed files with 30 additions and 24 deletions

View File

@ -453,8 +453,9 @@ static WIN16_SUBSYSTEM_TIB *allocate_win16_tib( TDB *pTask )
}
/* startup routine for a new 16-bit thread */
static DWORD CALLBACK task_start( TDB *pTask )
static DWORD CALLBACK task_start( LPVOID p )
{
TDB *pTask = (TDB *)p;
DWORD ret;
NtCurrentTeb()->htask16 = pTask->hSelf;
@ -480,7 +481,7 @@ HTASK16 TASK_SpawnTask( NE_MODULE *pModule, WORD cmdShow,
TDB *pTask;
if (!(pTask = TASK_Create( pModule, cmdShow, cmdline, len ))) return 0;
if (!(*hThread = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)task_start, pTask, 0, NULL )))
if (!(*hThread = CreateThread( NULL, 0, task_start, pTask, 0, NULL )))
{
TASK_DeleteTask( pTask->hSelf );
return 0;

View File

@ -58,7 +58,7 @@ static HANDLE StartNotificationThread(LPCSTR path, BOOL subtree, DWORD flags)
change = FindFirstChangeNotificationA(path, subtree, flags);
ok(change != INVALID_HANDLE_VALUE, "FindFirstChangeNotification error: %ld\n", GetLastError());
thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)NotificationThread, (LPVOID)change,
thread = CreateThread(NULL, 0, NotificationThread, (LPVOID)change,
0, &threadId);
ok(thread != INVALID_HANDLE_VALUE, "CreateThread error: %ld\n", GetLastError());

View File

@ -86,8 +86,9 @@ typedef struct {
that the thread local storage routines work correctly, and that
threads actually run concurrently
*/
VOID WINAPI threadFunc1(t1Struct *tstruct)
DWORD WINAPI threadFunc1(LPVOID p)
{
t1Struct *tstruct = (t1Struct *)p;
int i;
/* write our thread # into shared memory */
tstruct->threadmem[tstruct->threadnum]=GetCurrentThreadId();
@ -107,34 +108,36 @@ VOID WINAPI threadFunc1(t1Struct *tstruct)
/* Check that noone cahnged our tls memory */
ok((int)TlsGetValue(tlsIndex)-1==tstruct->threadnum,
"TlsGetValue failed\n");
ExitThread(NUM_THREADS+tstruct->threadnum);
return NUM_THREADS+tstruct->threadnum;
}
VOID WINAPI threadFunc2()
DWORD WINAPI threadFunc2(LPVOID p)
{
ExitThread(99);
return 99;
}
VOID WINAPI threadFunc3()
DWORD WINAPI threadFunc3(LPVOID p)
{
HANDLE thread;
thread=GetCurrentThread();
SuspendThread(thread);
ExitThread(99);
return 99;
}
VOID WINAPI threadFunc4(HANDLE event)
DWORD WINAPI threadFunc4(LPVOID p)
{
HANDLE event = (HANDLE)p;
if(event != NULL) {
SetEvent(event);
}
Sleep(99000);
ExitThread(0);
return 0;
}
#if CHECK_STACK
VOID WINAPI threadFunc5(DWORD *exitCode)
DWORD WINAPI threadFunc5(LPVOID p)
{
DWORD *exitCode = (DWORD *)p;
SYSTEM_INFO sysInfo;
sysInfo.dwPageSize=0;
GetSystemInfo(&sysInfo);
@ -147,7 +150,7 @@ VOID WINAPI threadFunc5(DWORD *exitCode)
*exitCode=1;
}
__ENDTRY
ExitThread(0);
return 0;
}
#endif
@ -179,7 +182,7 @@ VOID test_CreateThread_basic()
/* Test that passing arguments to threads works okay */
for(i=0;i<NUM_THREADS;i++) {
thread[i] = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)threadFunc1,
thread[i] = CreateThread(NULL,0,threadFunc1,
&tstruct[i],0,&threadid[i]);
ok(thread[i]!=NULL,"Create Thread failed\n");
}
@ -220,7 +223,7 @@ VOID test_CreateThread_suspended()
DWORD threadId;
int error;
thread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)threadFunc2,NULL,
thread = CreateThread(NULL,0,threadFunc2,NULL,
CREATE_SUSPENDED,&threadId);
ok(thread!=NULL,"Create Thread failed\n");
/* Check that the thread is suspended */
@ -249,7 +252,7 @@ VOID test_SuspendThread()
DWORD threadId,exitCode,error;
int i;
thread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)threadFunc3,NULL,
thread = CreateThread(NULL,0,threadFunc3,NULL,
0,&threadId);
ok(thread!=NULL,"Create Thread failed\n");
/* Check that the thread is suspended */
@ -307,7 +310,7 @@ VOID test_TerminateThread()
int i,error;
i=0; error=0;
event=CreateEventA(NULL,TRUE,FALSE,NULL);
thread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)threadFunc4,
thread = CreateThread(NULL,0,threadFunc4,
(LPVOID)event, 0,&threadId);
ok(thread!=NULL,"Create Thread failed\n");
/* Terminate thread has a race condition in Wine. If the thread is terminated
@ -358,7 +361,7 @@ VOID test_CreateThread_stack()
GetSystemInfo(&sysInfo);
ok(sysInfo.dwPageSize>0,"GetSystemInfo should return a valid page size\n");
thread = CreateThread(NULL,sysInfo.dwPageSize,
(LPTHREAD_START_ROUTINE)threadFunc5,&exitCode,
threadFunc5,&exitCode,
0,&threadId);
ok(WaitForSingleObject(thread,5000)==WAIT_OBJECT_0,
"TerminateThread didn't work\n");
@ -461,7 +464,7 @@ VOID test_GetThreadTimes()
DWORD threadId;
int error;
thread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)threadFunc2,NULL,
thread = CreateThread(NULL,0,threadFunc2,NULL,
CREATE_SUSPENDED,&threadId);
ok(thread!=NULL,"Create Thread failed\n");

View File

@ -1893,7 +1893,7 @@ static WINE_MMTHREAD* WINMM_GetmmThread(HANDLE16 h)
return (WINE_MMTHREAD*)MapSL( MAKESEGPTR(h, 0) );
}
void WINAPI WINE_mmThreadEntryPoint(DWORD);
DWORD WINAPI WINE_mmThreadEntryPoint(LPVOID);
/**************************************************************************
* mmThreadCreate [MMSYSTEM.1120]
@ -1951,8 +1951,8 @@ LRESULT WINAPI mmThreadCreate16(FARPROC16 fpThreadAddr, LPHANDLE16 lpHndl, DWORD
/* lpMMThd->hVxD = OpenVxDHandle(lpMMThd->hEvent); */
}
lpMMThd->hThread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)WINE_mmThreadEntryPoint,
(LPVOID)(DWORD)hndl, CREATE_SUSPENDED, &lpMMThd->dwThreadID);
lpMMThd->hThread = CreateThread(0, 0, WINE_mmThreadEntryPoint,
(LPVOID)(DWORD_PTR)hndl, CREATE_SUSPENDED, &lpMMThd->dwThreadID);
if (lpMMThd->hThread == 0) {
WARN("Couldn't create thread\n");
/* clean-up(VxDhandle...); devicedirectio... */
@ -2143,9 +2143,9 @@ HANDLE16 WINAPI mmThreadGetTask16(HANDLE16 hndl)
/**************************************************************************
* __wine_mmThreadEntryPoint (MMSYSTEM.2047)
*/
void WINAPI WINE_mmThreadEntryPoint(DWORD _pmt)
DWORD WINAPI WINE_mmThreadEntryPoint(LPVOID p)
{
HANDLE16 hndl = (HANDLE16)_pmt;
HANDLE16 hndl = (HANDLE16)(DWORD_PTR)p;
WINE_MMTHREAD* lpMMThd = WINMM_GetmmThread(hndl);
TRACE("(%04x %p)\n", hndl, lpMMThd);
@ -2173,6 +2173,8 @@ void WINAPI WINE_mmThreadEntryPoint(DWORD _pmt)
CloseHandle(lpMMThd->hEvent);
GlobalFree16(hndl);
TRACE("done\n");
return 0;
}
typedef BOOL16 (WINAPI *MMCPLCALLBACK)(HWND, LPCSTR, LPCSTR, LPCSTR);