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

Function TCPThreadFunc

examples/SharedMemory/GraphicsServerExample.cpp:146–607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144};
145
146void TCPThreadFunc(void* userPtr, void* lsMemory)
147{
148 printf("TCPThreadFunc thread started\n");
149
150 TCPArgs* args = (TCPArgs*)userPtr;
151 //int workLeft = true;
152 b3Clock clock;
153 clock.reset();
154 b3Clock sleepClock;
155 bool init = true;
156 if (init)
157 {
158 unsigned int cachedSharedParam = eTCPIsInitialized;
159
160 args->m_cs->lock();
161 args->m_cs->setSharedParam(0, eTCPIsInitialized);
162 args->m_cs->unlock();
163
164 double deltaTimeInSeconds = 0;
165 int numCmdSinceSleep1ms = 0;
166 unsigned long long int prevTime = clock.getTimeMicroseconds();
167
168#ifdef BT_ENABLE_CLSOCKET
169 b3Clock clock;
170 double timeOutInSeconds = 10;
171
172
173 bool isPhysicsClientConnected = true;
174 bool exitRequested = false;
175
176
177 if (!isPhysicsClientConnected)
178 {
179 printf("TCP thread error connecting to shared memory. Machine needs a reboot?\n");
180 }
181 btAssert(isPhysicsClientConnected);
182
183 printf("Starting TCP server using port %d\n", args->m_port);
184
185 CPassiveSocket socket;
186 CActiveSocket* pClient = NULL;
187
188 //--------------------------------------------------------------------------
189 // Initialize our socket object
190 //--------------------------------------------------------------------------
191 socket.Initialize();
192
193 socket.Listen("localhost", args->m_port);
194
195 socket.SetBlocking();
196
197 int curNumErr = 0;
198
199#endif
200
201 do
202 {
203

Callers

nothing calls this directly

Calls 15

submitStatusFunction · 0.85
ListenMethod · 0.80
SetBlockingMethod · 0.80
SetReceiveTimeoutMethod · 0.80
SetSendTimeoutMethod · 0.80
GetClientPortMethod · 0.80
GetClientAddrMethod · 0.80
ReceiveMethod · 0.80
GetDataMethod · 0.80
GetSocketErrorMethod · 0.80
IsSocketValidMethod · 0.80
GetBytesReceivedMethod · 0.80

Tested by

no test coverage detected