/* Returns: data from the queue or NULL, when no data is received before the timeout.  */
gpointer g_async_queue_timeout_pop(GAsyncQueue *queue, guint64 timeout)
/* Returns: data from the queue or NULL, when no data is received before the timeout.  */
gpointer g_async_queue_timeout_pop(GAsyncQueue *queue, guint64 timeout)
{
  gint64 end_time = g_get_monotonic_time () + timeout;
  gpointer retval;
  g_mutex_lock (&queue->mutex);
  retval = g_async_queue_pop_intern_unlocked (queue, TRUE, end_time);
  g_mutex_unlock (&queue->mutex);
  return retval;
}