MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / start

Method start

physx/source/foundation/src/windows/PsWindowsThread.cpp:220–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void ThreadImpl::start(uint32_t stackSize, Runnable* runnable)
221{
222 if(getThread(this)->state != _ThreadImpl::NotStarted)
223 return;
224 getThread(this)->state = _ThreadImpl::Started;
225
226 if(runnable && !getThread(this)->arg && !getThread(this)->fn)
227 getThread(this)->arg = runnable;
228
229 getThread(this)->thread =
230 CreateThread(NULL, stackSize, PxThreadStart, (LPVOID) this, CREATE_SUSPENDED, &getThread(this)->threadID);
231 if(!getThread(this)->thread)
232 {
233 physx::shdfnd::getFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__,
234 "PsWindowsThread::start: Failed to create thread.");
235 getThread(this)->state = _ThreadImpl::NotStarted;
236 return;
237 }
238
239 // set affinity, set name and resume
240 if(getThread(this)->affinityMask)
241 setAffinityMask(getThread(this)->affinityMask);
242
243 if (getThread(this)->name)
244 setName(getThread(this)->name);
245
246 DWORD rc = ResumeThread(getThread(this)->thread);
247 if(rc == DWORD(-1))
248 {
249 physx::shdfnd::getFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__,
250 "PsWindowsThread::start: Failed to resume thread.");
251 getThread(this)->state = _ThreadImpl::NotStarted;
252 return;
253 }
254}
255
256void ThreadImpl::signalQuit()
257{

Callers

nothing calls this directly

Calls 2

errorMethod · 0.80
getThreadFunction · 0.70

Tested by

no test coverage detected