MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / runTask

Method runTask

examples/MultiThreading/b3Win32ThreadSupport.cpp:72–112  ·  view source on GitHub ↗

send messages to SPUs

Source from the content-addressed store, hash-verified

70
71///send messages to SPUs
72void b3Win32ThreadSupport::runTask(int uiCommand, void* uiArgument0, int taskId)
73{
74 /// gMidphaseSPU.sendRequest(CMD_GATHER_AND_PROCESS_PAIRLIST, (void*) &taskDesc);
75
76 ///we should spawn an SPU task here, and in 'waitForResponse' it should wait for response of the (one of) the first tasks that finished
77
78 switch (uiCommand)
79 {
80 case B3_THREAD_SCHEDULE_TASK:
81 {
82//#define SINGLE_THREADED 1
83#ifdef SINGLE_THREADED
84
85 b3ThreadStatus& threadStatus = m_activeThreadStatus[0];
86 threadStatus.m_userPtr = (void*)uiArgument0;
87 threadStatus.m_userThreadFunc(threadStatus.m_userPtr, threadStatus.m_lsMemory);
88 HANDLE handle = 0;
89#else
90
91 b3ThreadStatus& threadStatus = m_activeThreadStatus[taskId];
92 b3Assert(taskId >= 0);
93 b3Assert(int(taskId) < m_activeThreadStatus.size());
94
95 threadStatus.m_commandId = uiCommand;
96 threadStatus.m_status = 1;
97 threadStatus.m_userPtr = (void*)uiArgument0;
98
99 ///fire event to start new task
100 SetEvent(threadStatus.m_eventStartHandle);
101
102#endif //CollisionTask_LocalStoreMemory
103
104 break;
105 }
106 default:
107 {
108 ///not implemented
109 b3Assert(0);
110 }
111 };
112}
113
114///check for messages from SPUs
115void b3Win32ThreadSupport::waitForResponse(int* puiArgument0, int* puiArgument1)

Callers 3

initPhysicsMethod · 0.45
mainFunction · 0.45

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected