patternsobserver
Observer Pattern (Callbacks) pattern for C development
Installation
Suivez les instructions du dépôt pour votre agent. Consultez les fichiers et dépendances avant l’installation.
Voir la source ↗GuidesInstructions
Observer Pattern (Callbacks)
Objects register interest in events and get notified when they occur. In C, implemented as callback function pointers with context.
ikigai Application
Streaming chunks: LLM client notifies REPL as response chunks arrive:
typedef void (*chunk_callback_t)(void *ctx, const char *chunk, size_t len);
res_t ik_llm_stream(client, messages, on_chunk, user_ctx);
Terminal resize: Signal handler notifies REPL of SIGWINCH.
Future uses:
- Database change notifications
- Tool execution progress
- Background task completion
Convention: Always pair callback function pointer with void *user_ctx parameter.
Exemples
Consultez les exemples du dépôt source.
Voir la source ↗Historique source
- Date d’indexation
- 2026-01-20
- Mise à jour de l’index
- 2026-01-26
- Branch
- main
Les dates concernent ce répertoire. Consultez le dépôt pour l’historique du code.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!