MCPcopy Create free account
hub / github.com/defold/defold / DoLogSynchronized

Function DoLogSynchronized

engine/dlib/src/dlib/log.cpp:337–348  ·  view source on GitHub ↗

Here we put logging that needs to be thread safe We either push it on the logger thread, or from the main thread if threads aren't supported (e.g. html5)

Source from the content-addressed store, hash-verified

335// Here we put logging that needs to be thread safe
336// We either push it on the logger thread, or from the main thread if threads aren't supported (e.g. html5)
337static void DoLogSynchronized(LogSeverity severity, const char* domain, const char* output, int output_len)
338{
339 DM_SPINLOCK_SCOPED_LOCK(g_ListenerLock); // Make sure no listeners are added or removed during the scope
340
341 int count = dmAtomicGet32(&dmLog::g_ListenersCount);
342 for (int i = count - 1; i >= 0 ; --i)
343 {
344 g_Listeners[i]((LogSeverity)severity, domain, output);
345 }
346
347 ProfileLogText("%s", output);
348}
349
350static void dmLogDispatch(dmMessage::Message *message, void* user_ptr)
351{

Callers 2

dmLogDispatchFunction · 0.85
LogInternalFunction · 0.85

Calls 2

dmAtomicGet32Function · 0.85
ProfileLogTextFunction · 0.50

Tested by

no test coverage detected