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

Method submitNamedTask

physx/source/task/src/TaskManager.cpp:294–334  ·  view source on GitHub ↗

If called at runtime, must be thread-safe */

Source from the content-addressed store, hash-verified

292
293/* If called at runtime, must be thread-safe */
294PxTaskID PxTaskMgr::submitNamedTask( PxTask *task, const char *name, PxTaskType::Enum type )
295{
296 if( task )
297 {
298 task->mTm = this;
299 task->submitted();
300 }
301
302 LOCK();
303
304 const PxTaskNameToIDMap::Entry *ret = mName2IDmap.find( name );
305 if( ret )
306 {
307 PxTaskID prereg = ret->second;
308 if( task )
309 {
310 /* name was registered for us by a dependent task */
311 PX_ASSERT( !mTaskTable[ prereg ].mTask );
312 PX_ASSERT( mTaskTable[ prereg ].mType == PxTaskType::TT_NOT_PRESENT );
313 mTaskTable[ prereg ].mTask = task;
314 mTaskTable[ prereg ].mType = type;
315 task->mTaskID = prereg;
316 }
317 return prereg;
318 }
319 else
320 {
321 shdfnd::atomicIncrement(&mPendingTasks);
322 PxTaskID id = static_cast<PxTaskID>(mTaskTable.size());
323 mName2IDmap[ name ] = id;
324 if( task )
325 {
326 task->mTaskID = id;
327 }
328 PxTaskTableRow r;
329 r.mTask = task;
330 r.mType = type;
331 mTaskTable.pushBack(r);
332 return id;
333 }
334}
335
336/*
337 * Add an unnamed task to the task table

Callers

nothing calls this directly

Calls 5

submittedMethod · 0.80
atomicIncrementFunction · 0.50
findMethod · 0.45
sizeMethod · 0.45
pushBackMethod · 0.45

Tested by

no test coverage detected