MCPcopy Create free account
hub / github.com/assaultcube/AC / poll_logbuffers

Function poll_logbuffers

source/src/log.cpp:208–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206extern int stat_theadlog_peaklevel;
207
208void poll_logbuffers() // just copy threadlog to mainlog and restart blocked threads, if necessary
209{
210 int threadloglevel = (100 * threadlog.length()) / threadlog.maxsize();
211 if(threadloglevel > stat_theadlog_peaklevel) stat_theadlog_peaklevel = threadloglevel;
212 while(!mainlog.full() && !threadlog.empty())
213 {
214 mainlog.stage(threadlog.remove());
215 mainlog.commit();
216 }
217 if(mainlogoverflow && !mainlog.full())
218 {
219 mlog(ACLOG_ERROR, "main log ringbuffer overflow, %d entries lost", mainlogoverflow);
220 mainlogoverflow = 0;
221 }
222 if(!threadlog.full() && threadlogfullsem.getvalue() < 1) threadlogfullsem.post();
223 if(!mainlog.empty() && mainlogsem.getvalue() < 1) mainlogsem.post();
224}

Callers 1

poll_serverthreadsFunction · 0.85

Calls 10

mlogFunction · 0.85
maxsizeMethod · 0.80
fullMethod · 0.80
stageMethod · 0.80
commitMethod · 0.80
getvalueMethod · 0.80
postMethod · 0.80
lengthMethod · 0.45
emptyMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected