MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / LocalUserInput_GetNext

Function LocalUserInput_GetNext

examples/example_chat.cpp:209–223  ·  view source on GitHub ↗

Read the next line of input from stdin, if anything is available.

Source from the content-addressed store, hash-verified

207
208// Read the next line of input from stdin, if anything is available.
209bool LocalUserInput_GetNext( std::string &result )
210{
211 bool got_input = false;
212 mutexUserInputQueue.lock();
213 while ( !queueUserInput.empty() && !got_input )
214 {
215 result = queueUserInput.front();
216 queueUserInput.pop();
217 ltrim(result);
218 rtrim(result);
219 got_input = !result.empty(); // ignore blank lines
220 }
221 mutexUserInputQueue.unlock();
222 return got_input;
223}
224
225/////////////////////////////////////////////////////////////////////////////
226//

Callers 2

PollLocalUserInputMethod · 0.85
PollLocalUserInputMethod · 0.85

Calls 5

ltrimFunction · 0.85
rtrimFunction · 0.85
lockMethod · 0.80
unlockMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected