Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Startup

Initialize and shut down the gobj runtime and control the process exit code. Call gobj_start_up() once before any other gobj function and gobj_end() on termination.

Source code:

gobj_end()

De-initializes the gobj system, freeing resources and shutting down the yuno if it exists.

void gobj_end(void);

Parameters

KeyTypeDescription
--This function does not take any parameters.

Returns

None.

Notes

If a yuno exists, it will be stopped and destroyed before freeing global resources.


gobj_get_exit_code()

Retrieves the exit code set for the application shutdown process.

int gobj_get_exit_code(void);

Parameters

KeyTypeDescription
--This function does not take any parameters.

Returns

Returns the exit code as an integer.

Notes

The exit code is set using gobj_set_exit_code().


gobj_is_shutdowning()

Checks if the system is in the process of shutting down.

BOOL gobj_is_shutdowning(void);

Parameters

KeyTypeDescription
--This function does not take any parameters.

Returns

Returns TRUE if the system is shutting down, otherwise returns FALSE.

Notes

This function is useful for determining whether the system is in the process of shutting down, allowing components to take appropriate actions.


gobj_set_exit_code()

Sets the exit code for the process, which will be returned when the program terminates.

void gobj_set_exit_code(int exit_code);

Parameters

KeyTypeDescription
exit_codeintThe exit code to be set for the process.

Returns

This function does not return a value.

Notes

The exit code set by this function can be retrieved using gobj_get_exit_code().


gobj_start_up()

gobj_start_up() initializes the gobj system, setting up global settings, memory management, and persistent attributes.

int gobj_start_up(
    int argc,
    char *argv[],
    const json_t *jn_global_settings,
    const persistent_attrs_t *persistent_attrs,
    json_function_fn global_command_parser,
    json_function_fn global_statistics_parser,
    authorization_checker_fn global_authorization_checker,
    authentication_parser_fn global_authentication_parser
);

Parameters

KeyTypeDescription
argcintNumber of command-line arguments.
argvchar *argv[]Array of command-line arguments.
jn_global_settingsconst json_t *Global settings in JSON format (not owned).
persistent_attrsconst persistent_attrs_t *Persistent attributes management functions.
global_command_parserjson_function_fnGlobal command parser function.
global_statistics_parserjson_function_fnGlobal statistics parser function.
global_authorization_checkerauthorization_checker_fnGlobal authorization checker function.
global_authentication_parserauthentication_parser_fnGlobal authentication parser function.
mem_max_blocksize_tMaximum memory block size.
mem_max_system_memorysize_tMaximum system memory allocation.
use_own_system_memoryBOOLFlag to use internal memory manager.
mem_min_blocksize_tMinimum memory block size (used only in internal memory manager).
mem_superblocksize_tSuperblock size (used only in internal memory manager).

Returns

Returns 0 on success, -1 if already initialized.

Notes

This function must be called before using any other gobj-related functions. If persistent_attrs is provided, it initializes persistent attributes. If global_command_parser is NULL, an internal command parser is used. If global_statistics_parser is NULL, an internal statistics parser is used. If global_authorization_checker is NULL, authorization checks are disabled. If global_authentication_parser is NULL, authentication is bypassed.


gobj_set_shutdown()

Marks the gobj system as shutting down. Once called, gobj_is_shutdowning() will return TRUE. This flag is used throughout the framework to signal that the yuno is in the process of shutting down, allowing GClasses to perform cleanup and stop accepting new work.

void gobj_set_shutdown(void);

Parameters

KeyTypeDescription
--This function does not take any parameters.

Returns

This function does not return a value.

Notes

Calling this function multiple times is safe -- subsequent calls are ignored if the shutdown flag is already set. Use gobj_is_shutdowning() to check the current shutdown state.