Problem:
- Receivers were exiting after receiving only messages_per_sender (5) messages
- In broadcast mode, each message is sent to ALL receivers
- If sender1 completes quickly, all receivers get 5 messages and exit
- This causes sender2's messages to fail (no active receivers)
Solution:
- Each receiver should loop for num_senders * messages_per_sender (2 * 5 = 10) messages
- This ensures all receivers stay active until ALL senders complete
- Now receivers wait for: 2 senders × 5 messages each = 10 total messages
- Expected received_count: 2 senders × 5 messages × 2 receivers = 20 messages
This fix ensures all senders can successfully complete their sends before
any receiver exits.
1. ChannelTest::MultipleSendersReceivers
- Add C++14-compatible latch implementation (similar to C++20 std::latch)
- Ensure receivers are ready before senders start sending messages
- This prevents race condition where senders might send before receivers are listening
2. RWLockTest::ReadWriteReadPattern
- Fix test logic: lock_shared allows multiple concurrent readers
- Previous test had race condition where both threads could read same value
- New test: each thread writes based on thread id (1 or 2), then reads
- Expected result: 1*20 + 2*20 = 60
3. ShmTest::ReleaseMemory
- Correct return value semantics: release() returns ref count before decrement, or -1 on error
- Must call get_mem() to map memory and set ref count to 1 before release
- Expected: release() returns 1 (ref count before decrement)
4. ShmTest::ReferenceCount
- Correct semantics: ref count is 0 after acquire (memory not mapped)
- get_mem() maps memory and sets ref count to 1
- Second acquire+get_mem increases ref count to 2
- Test now properly validates reference counting behavior
5. ShmTest::SubtractReference
- sub_ref() only works after get_mem() has mapped the memory
- Must call get_mem() first to initialize ref count to 1
- sub_ref() then decrements it to 0
- Test now follows correct API usage pattern
- Test route (single producer, multiple consumer) functionality
- Test channel (multiple producer, multiple consumer) functionality
- Test construction with name and prefix
- Test connection, disconnection, and reconnection
- Test send/receive with buffer, string, and raw data
- Test blocking send/recv and non-blocking try_send/try_recv
- Test timeout handling
- Test one-to-many broadcast (route)
- Test many-to-many communication (channel)
- Test recv_count and wait_for_recv functionality
- Test clone, release, and clear operations
- Test resource cleanup and storage management
- Test concurrent multi-sender and multi-receiver scenarios