From f98abe0ee778880408863aff8371f4749f1f9b49 Mon Sep 17 00:00:00 2001 From: Clément Bœsch Date: Mon, 30 Nov 2015 18:18:42 +0100 Subject: avutil/threadmessage: add av_thread_message_flush() --- libavutil/threadmessage.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libavutil/threadmessage.h') diff --git a/libavutil/threadmessage.h b/libavutil/threadmessage.h index a8481d8ec3..e256cae9db 100644 --- a/libavutil/threadmessage.h +++ b/libavutil/threadmessage.h @@ -88,4 +88,20 @@ void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq, void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq, int err); +/** + * Set the optional free message callback function which will be called if an + * operation is removing messages from the queue. + */ +void av_thread_message_queue_set_free_func(AVThreadMessageQueue *mq, + void (*free_func)(void *msg)); + +/** + * Flush the message queue + * + * This function is mostly equivalent to reading and free-ing every message + * except that it will be done in a single operation (no lock/unlock between + * reads). + */ +void av_thread_message_flush(AVThreadMessageQueue *mq); + #endif /* AVUTIL_THREADMESSAGE_H */ -- cgit v1.2.3