Updated: October 28, 2024 |
Create a context
#include <mm/renderer.h>
mmr_context_t* mmr_context_create(mmr_connection_t *connection, const char *name, unsigned flags, mode_t mode)
Create the specified context and open a handle to it. If a context with the same name already exists, the function fails. The name can be any string that appropriately identifies the context.
The value given for mode is a standard POSIX permissions bitfield but only the w bits are meaningful; the mode argument description explains how these bits control which other processes can open handles to the context.
When successful, the function returns a handle, called the primary handle, for accessing the new context. You may be able to create secondary handles to the context by calling mmr_context_open(), depending on the mm-renderer command-line options.
To avoid memory leaks, every context handle needs to eventually be closed, either explicitly through an API call or implicitly by disconnecting from mm-renderer or terminating the process.
A handle on success, or a NULL pointer on failure (check errno)