42 atomic_store(&g_shutdown_callback, callback);
47 if (callback == NULL) {
58#if defined(DEBUG_MEMORY) && !defined(USE_MIMALLOC_DEBUG) && !defined(NDEBUG)
60#elif defined(USE_MIMALLOC_DEBUG) && !defined(NDEBUG)
61static void print_mimalloc_stats(
void);
68#if defined(DEBUG_MEMORY) && !defined(USE_MIMALLOC_DEBUG) && !defined(NDEBUG)
69 (void)atexit(debug_memory_report);
70#elif defined(USE_MIMALLOC_DEBUG) && !defined(NDEBUG)
71 (void)atexit(print_mimalloc_stats);
72 UNUSED(print_mimalloc_stats);
121#if defined(DEBUG_MEMORY) && !defined(USE_MIMALLOC_DEBUG) && !defined(NDEBUG)
122 debug_memory_set_quiet_mode(
GET_OPTION(quiet));
128#if defined(USE_MIMALLOC_DEBUG) && !defined(NDEBUG)
131static void print_mimalloc_stats(
void) {
132 mi_stats_print(NULL);
⚠️‼️ Error and/or exit() when things go bad.
🗃️ Lock-Free Unified Memory Buffer Pool with Lazy Allocation
🔍 Memory debugging helpers for tracking allocations in debug builds
void buffer_pool_cleanup_global(void)
void buffer_pool_init_global(void)
asciichat_error_t asciichat_shared_init(const char *default_log_filename, bool is_client)
Initialize common subsystems shared by client and server.
#define FATAL(code,...)
Exit with error code and custom message, with stack trace in debug builds.
void known_hosts_cleanup(void)
Cleanup function to free cached known_hosts path.
void asciichat_errno_cleanup(void)
Cleanup error system resources.
asciichat_error_t
Error and exit codes - unified status values (0-255)
int g_max_fps
Runtime configurable maximum frame rate (can be overridden via environment or command line)
void log_truncate_if_large(void)
Manually truncate large log files.
void log_init(const char *filename, log_level_t level, bool force_stderr, bool use_mmap)
Initialize the logging system.
#define log_file(...)
File-only logging - writes to log file only, no stderr output.
void log_set_terminal_output(bool enabled)
Control stderr output to terminal.
#define GET_OPTION(field)
Safely get a specific option field (lock-free read)
const options_t * options_get(void)
Get current options (lock-free read)
int apply_palette_config(palette_type_t type, const char *custom_chars)
Apply palette configuration (set global palette)
bool(* shutdown_check_fn)(void)
Shutdown check callback function type.
bool shutdown_is_requested(void)
Check if shutdown has been requested.
void shutdown_register_callback(shutdown_check_fn callback)
Register application's shutdown check function.
Platform initialization and static synchronization helpers.
Known hosts management for MITM attack prevention.
Application limits and constraints.
📝 Logging API with multiple log levels and terminal output control
⚙️ Command-line options parsing and configuration management for ascii-chat
ASCII Palette Management for Video-to-ASCII Conversion.
void options_state_shutdown(void)
Shutdown RCU options system.
Consolidated options structure.
char palette_custom[256]
Custom palette characters.
bool palette_custom_set
True if custom palette was set.
char log_file[256]
Log file path.
Cross-platform system functions interface for ascii-chat.
Common SIMD utilities and structures.