MCPcopy Create free account
hub / github.com/SFML/SFML / acquireTransientContext

Method acquireTransientContext

src/SFML/Window/GlContext.cpp:505–525  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

503
504////////////////////////////////////////////////////////////
505void GlContext::acquireTransientContext()
506{
507 auto& currentContext = GlContextImpl::CurrentContext::get();
508
509 // Fast path if we already have a context active on this thread
510 if (currentContext.id)
511 {
512 ++currentContext.transientCount;
513 return;
514 }
515
516 // If we don't already have a context active on this thread the count should be 0
517 assert(!currentContext.transientCount && "Transient count cannot be non-zero");
518
519 // If currentContextId is not set, this must be the first
520 // TransientContextLock on this thread, construct the state object
521 TransientContext::get().emplace();
522
523 // Make sure a context is active at this point
524 assert(currentContext.id && "Current context ID cannot be zero");
525}
526
527
528////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected