ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches
common.c File Reference

🔧 Core utilities: memory management, safe macros, and cross-platform helpers More...

Go to the source code of this file.

Functions

void shutdown_register_callback (shutdown_check_fn callback)
 Register application's shutdown check function.
void shutdown_request (void)
bool shutdown_is_requested (void)
 Check if shutdown has been requested.
 __attribute__ ((constructor))
 Register fork handlers for common module.
asciichat_error_t asciichat_shared_init (const char *log_file, bool is_client, bool quiet_startup)
 Initialize common subsystems shared by client and server.
void asciichat_shared_destroy (void)
 Clean up all shared library subsystems.

Variables

int g_argc = 0
 Global argc for early argument inspection (e.g., –color flag detection) Set by main() for access from libplatform's terminal implementation during early execution.
char ** g_argv = NULL
 Global argv for early argument inspection (e.g., –color flag detection) Set by main() for access from libplatform's terminal implementation during early execution.
bool g_color_flag_passed = false
 Was –color explicitly passed in command-line arguments? Set by options_init() before RCU is initialized, used by terminal_should_color_output().
bool g_color_flag_value = false
 Value of –color flag (true if –color was in argv) Set by options_init() before RCU is initialized, used by terminal_should_color_output().

Detailed Description

🔧 Core utilities: memory management, safe macros, and cross-platform helpers

Definition in file common.c.

Function Documentation

◆ __attribute__()

__attribute__ ( (constructor) )

Register fork handlers for common module.

Definition at line 126 of file common.c.

126 {
127 pthread_atfork(NULL, NULL, asciichat_common_atfork_child);
128}