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

Method setAffinityMask

physx/source/foundation/src/unix/PsUnixThread.cpp:300–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300uint32_t ThreadImpl::setAffinityMask(uint32_t mask)
301{
302 // Same as windows impl if mask is zero
303 if(!mask)
304 return 0;
305
306 getThread(this)->affinityMask = mask;
307
308 uint64_t prevMask = 0;
309
310 if(getThread(this)->state == _PxThreadStarted)
311 {
312#if PX_PS4
313 prevMask = setAffinityMaskPS4(getThread(this)->thread, mask);
314#elif PX_EMSCRIPTEN
315 // not supported
316#elif !PX_APPLE_FAMILY // Apple doesn't support syscall with getaffinity and setaffinity
317 int32_t errGet = syscall(__NR_sched_getaffinity, getThread(this)->tid, sizeof(prevMask), &prevMask);
318 if(errGet < 0)
319 return 0;
320
321 int32_t errSet = syscall(__NR_sched_setaffinity, getThread(this)->tid, sizeof(mask), &mask);
322 if(errSet != 0)
323 return 0;
324#endif
325 }
326
327 return uint32_t(prevMask);
328}
329
330void ThreadImpl::setName(const char* name)
331{

Callers 1

DefaultCpuDispatcherMethod · 0.45

Calls 1

getThreadFunction · 0.70

Tested by

no test coverage detected