gasyncqueue.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* GLIB - Library of useful routines for C programming
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. *
  4. * SPDX-License-Identifier: LGPL-2.1-or-later
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /*
  20. * Modified by the GLib Team and others 1997-2000. See the AUTHORS
  21. * file for a list of people on the GLib Team. See the ChangeLog
  22. * files for a list of changes. These files are distributed with
  23. * GLib at ftp://ftp.gtk.org/pub/gtk/.
  24. */
  25. #ifndef __G_ASYNCQUEUE_H__
  26. #define __G_ASYNCQUEUE_H__
  27. #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
  28. #error "Only <glib.h> can be included directly."
  29. #endif
  30. #include <glib/gthread.h>
  31. G_BEGIN_DECLS
  32. typedef struct _GAsyncQueue GAsyncQueue;
  33. GLIB_AVAILABLE_IN_ALL
  34. GAsyncQueue *g_async_queue_new (void);
  35. GLIB_AVAILABLE_IN_ALL
  36. GAsyncQueue *g_async_queue_new_full (GDestroyNotify item_free_func);
  37. GLIB_AVAILABLE_IN_ALL
  38. void g_async_queue_lock (GAsyncQueue *queue);
  39. GLIB_AVAILABLE_IN_ALL
  40. void g_async_queue_unlock (GAsyncQueue *queue);
  41. GLIB_AVAILABLE_IN_ALL
  42. GAsyncQueue *g_async_queue_ref (GAsyncQueue *queue);
  43. GLIB_AVAILABLE_IN_ALL
  44. void g_async_queue_unref (GAsyncQueue *queue);
  45. GLIB_DEPRECATED_FOR(g_async_queue_ref)
  46. void g_async_queue_ref_unlocked (GAsyncQueue *queue);
  47. GLIB_DEPRECATED_FOR(g_async_queue_unref)
  48. void g_async_queue_unref_and_unlock (GAsyncQueue *queue);
  49. GLIB_AVAILABLE_IN_ALL
  50. void g_async_queue_push (GAsyncQueue *queue,
  51. gpointer data);
  52. GLIB_AVAILABLE_IN_ALL
  53. void g_async_queue_push_unlocked (GAsyncQueue *queue,
  54. gpointer data);
  55. GLIB_AVAILABLE_IN_ALL
  56. void g_async_queue_push_sorted (GAsyncQueue *queue,
  57. gpointer data,
  58. GCompareDataFunc func,
  59. gpointer user_data);
  60. GLIB_AVAILABLE_IN_ALL
  61. void g_async_queue_push_sorted_unlocked (GAsyncQueue *queue,
  62. gpointer data,
  63. GCompareDataFunc func,
  64. gpointer user_data);
  65. GLIB_AVAILABLE_IN_ALL
  66. gpointer g_async_queue_pop (GAsyncQueue *queue);
  67. GLIB_AVAILABLE_IN_ALL
  68. gpointer g_async_queue_pop_unlocked (GAsyncQueue *queue);
  69. GLIB_AVAILABLE_IN_ALL
  70. gpointer g_async_queue_try_pop (GAsyncQueue *queue);
  71. GLIB_AVAILABLE_IN_ALL
  72. gpointer g_async_queue_try_pop_unlocked (GAsyncQueue *queue);
  73. GLIB_AVAILABLE_IN_ALL
  74. gpointer g_async_queue_timeout_pop (GAsyncQueue *queue,
  75. guint64 timeout);
  76. GLIB_AVAILABLE_IN_ALL
  77. gpointer g_async_queue_timeout_pop_unlocked (GAsyncQueue *queue,
  78. guint64 timeout);
  79. GLIB_AVAILABLE_IN_ALL
  80. gint g_async_queue_length (GAsyncQueue *queue);
  81. GLIB_AVAILABLE_IN_ALL
  82. gint g_async_queue_length_unlocked (GAsyncQueue *queue);
  83. GLIB_AVAILABLE_IN_ALL
  84. void g_async_queue_sort (GAsyncQueue *queue,
  85. GCompareDataFunc func,
  86. gpointer user_data);
  87. GLIB_AVAILABLE_IN_ALL
  88. void g_async_queue_sort_unlocked (GAsyncQueue *queue,
  89. GCompareDataFunc func,
  90. gpointer user_data);
  91. GLIB_AVAILABLE_IN_2_46
  92. gboolean g_async_queue_remove (GAsyncQueue *queue,
  93. gpointer item);
  94. GLIB_AVAILABLE_IN_2_46
  95. gboolean g_async_queue_remove_unlocked (GAsyncQueue *queue,
  96. gpointer item);
  97. GLIB_AVAILABLE_IN_2_46
  98. void g_async_queue_push_front (GAsyncQueue *queue,
  99. gpointer item);
  100. GLIB_AVAILABLE_IN_2_46
  101. void g_async_queue_push_front_unlocked (GAsyncQueue *queue,
  102. gpointer item);
  103. G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  104. GLIB_DEPRECATED_FOR(g_async_queue_timeout_pop)
  105. gpointer g_async_queue_timed_pop (GAsyncQueue *queue,
  106. GTimeVal *end_time);
  107. GLIB_DEPRECATED_FOR(g_async_queue_timeout_pop_unlocked)
  108. gpointer g_async_queue_timed_pop_unlocked (GAsyncQueue *queue,
  109. GTimeVal *end_time);
  110. G_GNUC_END_IGNORE_DEPRECATIONS
  111. G_END_DECLS
  112. #endif /* __G_ASYNCQUEUE_H__ */