How geniusdai/cppev works
Cppev is a C++ asynchronous I/O and concurrency library. Its principal server workflow configures and starts a TCP server, accepts connections, registers sockets with event loops, and invokes user callbacks as I/O events occur. The README also documents standalone disk/pipe/socket I/O, UDP, synchronization, IPC, subprocess, and runtime dynamic-library loading. Source excerpts clarify parts of the I/O and TCP reactor; other subsystem links reflect documented capabilities and file-tree paths, not inspected call paths.
Main entry points: event_loop_common.cc Event loop · tcp.cc Socket event handler · io.cc File and socket I/O · event_loop_epoll.cc OS event pollers
Components 18
I/O and reactor
- TCP server/client
src/lib/tcp.cc - Connection acceptor
src/lib/tcp.cc - Socket event handler
src/lib/tcp.cc - Event loop
src/lib/event_loop_common.cc - OS event pollers
src/lib/event_loop_epoll.cc - File and socket I/O
src/lib/io.cc - I/O buffers
src/include/cppev/buffer.h
Concurrency and synchronization
- Thread pool
src/lib/thread_pool.cc - Runnable threads
src/lib/runnable.cc - Scheduler
- Synchronization primitives
src/lib/lock.cc - Shared memory and semaphores
src/lib/ipc.cc
Processes and loading
- Subprocess execution
src/lib/subprocess.cc - Dynamic loader
src/lib/dynamic_loader.cc
Library support
- Logging
src/lib/logger.cc - Common utilities
src/lib/utils.cc
Other components
- Library user
- Operating system
Connections 23
- Library user → TCP server/client: configures and starts
- TCP server/client → Connection acceptor: starts acceptors
- TCP server/client → Thread pool: runs I/O workers
- Connection acceptor → Event loop: monitors listeners
- Connection acceptor → Socket event handler: registers connections
- Socket event handler → Event loop: registers sockets
- Event loop → OS event pollers: waits for events
- OS event pollers → Event loop: returns ready events
- Event loop → Socket event handler: dispatches callbacks
- Socket event handler → File and socket I/O: reads and writes
- File and socket I/O → I/O buffers: uses buffers
- Library user → File and socket I/O: uses I/O
- Library user → Scheduler: schedules work
- Library user → Runnable threads: runs threads
- Library user → Synchronization primitives: synchronizes
- Library user → Shared memory and semaphores: uses IPC
- Library user → Subprocess execution: launches processes
- Library user → Dynamic loader: loads libraries
- File and socket I/O → Operating system: performs system I/O
- Synchronization primitives → Operating system: uses pthread primitives
- Shared memory and semaphores → Operating system: uses IPC facilities
- Subprocess execution → Operating system: creates processes
- Dynamic loader → Operating system: loads binaries