Skip to content

tomoss/mq-timed-with-monotonic-clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MQ Timed With Monotonic Clock

C++17+ Build CI platform Linux x86_64 platform Linux ARM

POSIX message queue functions with CLOCK_MONOTONIC timeout support

The POSIX message queue functions mq_timedreceive() and mq_timedsend() are limited to CLOCK_REALTIME for their timeout parameter.

This repository provides two wrapper functions: mq_timedreceive_monotonic() and mq_timedsend_monotonic(), which use CLOCK_MONOTONIC instead.

The implementation is based primarily on poll().


Integration test for realtime vs monotonic timeout behavior

This repository also includes an integration test that demonstrates the difference between:

  • mq_timedreceive() using CLOCK_REALTIME
  • mq_timedreceive_monotonic() using CLOCK_MONOTONIC

The test changes the Linux system wall clock while both modes are waiting, showing that:

  • the mq_timedreceive() timeout is affected by wall-clock changes
  • the mq_timedreceive_monotonic() timeout remains stable

See tests/integration/README.md for details about what the test verifies and how to run it.

About

POSIX message queue functions with CLOCK_MONOTONIC timeout support.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors