Essentials

resource.h

Register resources for coordinated application shutdown.

C++23 mc/resource.h
#include <mc/resource.h>

Implement CResource::closeResource() in a resource subclass. Keep shutdown and resource lifetimes coordinated, particularly during concurrent destruction.

Jump to a declaration · 7

CResourceManager

Methods

shutdown

static void shutdown();

Invokes registered closers. All closers are attempted, then the first failure is rethrown.

CResource

class CResource

Methods

CResource

Registers the resource for coordinated shutdown. Its lifetime must be coordinated with shutdown callbacks; destruction unregisters it.

closeResource

virtual void closeResource() = 0;

Implement this to close the resource during coordinated shutdown. It must leave the object safe for later destruction; registration does not transfer object ownership.