Changeset 8648 for trunk/src/kernel32/hmthread.cpp
- Timestamp:
- Jun 11, 2002, 6:36:54 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/hmthread.cpp
r8465 r8648 1 /* $Id: hmthread.cpp,v 1.1 2 2002-05-22 12:57:42sandervl Exp $ */1 /* $Id: hmthread.cpp,v 1.13 2002-06-11 16:36:53 sandervl Exp $ */ 2 2 3 3 /* … … 46 46 BOOL fFirstThread) 47 47 { 48 Win32Thread *winthread; 49 DWORD threadid; 50 51 if(lpIDThread == NULL) { 48 Win32Thread *winthread; 49 DWORD threadid; 50 HANDLE hThread = pHMHandleData->hHMHandle; 51 52 if(lpIDThread == NULL) { 52 53 lpIDThread = &threadid; 53 } 54 pHMHandleData->dwInternalType = HMTYPE_THREAD; 55 pHMHandleData->dwUserData = THREAD_ALIVE; 56 57 //SvL: This doesn't really create a thread, but only sets up the 58 // handle of thread 0 59 if(fFirstThread) { 60 pHMHandleData->hHMHandle = O32_GetCurrentThread(); //return Open32 handle of thread 61 return pHMHandleData->hHMHandle; 62 } 63 winthread = new Win32Thread(lpStartAddr, lpvThreadParm, fdwCreate, pHMHandleData->hHMHandle); 64 65 if(winthread == 0) { 66 SetLastError(ERROR_NOT_ENOUGH_MEMORY); 67 return(0); 68 } 69 // @@@PH Note: with debug code enabled, ODIN might request more stack space! 70 //SvL: Also need more stack in release build (RealPlayer 7 sometimes runs 71 // out of stack 72 if (cbStack > 0) 73 cbStack <<= 1; // double stack 74 else 75 cbStack = 1048576; // per default 1MB stack per thread 76 77 pHMHandleData->hHMHandle = O32_CreateThread(lpsa, 78 cbStack, 79 winthread->GetOS2Callback(), 80 (LPVOID)winthread, 81 fdwCreate, 82 lpIDThread); 83 84 if(lpIDThread) { 85 *lpIDThread = MAKE_THREADID(O32_GetCurrentProcessId(), *lpIDThread); 86 } 87 dprintf(("CreateThread created %08xh\n", pHMHandleData->hHMHandle)); 54 } 55 pHMHandleData->dwInternalType = HMTYPE_THREAD; 56 pHMHandleData->dwUserData = THREAD_ALIVE; 57 58 //SvL: This doesn't really create a thread, but only sets up the 59 // handle of thread 0 60 if(fFirstThread) { 61 pHMHandleData->hHMHandle = O32_GetCurrentThread(); //return Open32 handle of thread 62 return pHMHandleData->hHMHandle; 63 } 64 winthread = new Win32Thread(lpStartAddr, lpvThreadParm, fdwCreate, hThread); 65 66 if(winthread == 0) { 67 DebugInt3(); 68 SetLastError(ERROR_NOT_ENOUGH_MEMORY); 69 return(0); 70 } 71 // @@@PH Note: with debug code enabled, ODIN might request more stack space! 72 //SvL: Also need more stack in release build (RealPlayer 7 sometimes runs 73 // out of stack 74 if (cbStack > 0) 75 cbStack <<= 1; // double stack 76 else 77 cbStack = 1048576; // per default 1MB stack per thread 78 79 pHMHandleData->hHMHandle = O32_CreateThread(lpsa, cbStack, winthread->GetOS2Callback(), 80 (LPVOID)winthread, fdwCreate, lpIDThread); 81 82 *lpIDThread = MAKE_THREADID(O32_GetCurrentProcessId(), *lpIDThread); 83 84 TEB *teb = GetTEBFromThreadHandle(hThread); 85 if(teb) { 86 //store thread id in TEB 87 teb->o.odin.threadId = *lpIDThread; 88 } 89 dprintf(("CreateThread created %08x, id %x", pHMHandleData->hHMHandle, *lpIDThread)); 88 90 89 return pHMHandleData->hHMHandle;91 return pHMHandleData->hHMHandle; 90 92 } 91 93 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.