One part of my program creates some kind of messages. These messages are then processed in the second part.
I need some kind of temporary queue between parts of my program, which can store messages in memory for X seconds. X does not change as long as such a queue of time exists.
Ideally, it should look like this:
tqueue_t *tqueue_new(int seconds); int tqueue_push(tqueue_t *queue, void *msg); void *tqueue_pop(tqueue_t *queue);
tqueue_pop() should block and return when the first message has been in the queue for X seconds.
What is the best way to do this? Perhaps there are already existing solutions?
Language: C
OS: * nix
In addition, this queue should work in a streaming environment.
source share