MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / get

Method get

util/GenericQ.cpp:93–114  ·  view source on GitHub ↗

This will block until there is something in the queue

Source from the content-addressed store, hash-verified

91
92// This will block until there is something in the queue
93void GenericQ::get(void **item, bool nonBlocking)
94{
95 if(deadYet) return;
96 if(item == NULL) THROW("NULL argument in GenericQ::get()");
97 if(nonBlocking)
98 {
99 if(!hasItem.tryWait())
100 {
101 *item = NULL; return;
102 }
103 }
104 else hasItem.wait();
105 if(!deadYet)
106 {
107 CriticalSection::SafeLock l(mutex);
108 if(deadYet) return;
109 if(start == NULL) THROW("Nothing in the queue");
110 *item = start->item;
111 Entry *temp = start->next;
112 delete start; start = temp;
113 }
114}
115
116
117int GenericQ::items(void)

Callers 4

runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
dotestMethod · 0.45

Calls 2

tryWaitMethod · 0.80
waitMethod · 0.45

Tested by

no test coverage detected