* SECTION:priority_queues
* @short_description: a collection of data entries with associated priority
* values that returns entries one by one in order of priority
* SECTION:priority_queues
* @short_description: a collection of data entries with associated priority
* values that returns entries one by one in order of priority
* <para>
* The #GPQueue structure and its associated functions provide a sorted
* collection of objects. Entries can be inserted in any order and at any time,
* <para>
* The #GPQueue structure and its associated functions provide a sorted
* collection of objects. Entries can be inserted in any order and at any time,
* they are equal, a negative value if the first comes before the second, and
* a positive value if the second comes before the first.
* @compare_userdata: user data passed to @compare_func
* they are equal, a negative value if the first comes before the second, and
* a positive value if the second comes before the first.
* @compare_userdata: user data passed to @compare_func
* @user_data: user data to pass to func
*
* Calls func for each element in the pqueue passing user_data to the function.
* @user_data: user data to pass to func
*
* Calls func for each element in the pqueue passing user_data to the function.
* updating the priorities of all the elements in pqueue.
*
* Returns: A GPtrArray containing a pointer to each item in pqueue
* updating the priorities of all the elements in pqueue.
*
* Returns: A GPtrArray containing a pointer to each item in pqueue
* The returned handle can be used in calls to g_pqueue_remove() and
* g_pqueue_priority_changed(). Never make such calls for entries that have
* already been removed from the queue. The same @data can be inserted into
* a #GPQueue more than once, but remember that in this case,
* g_pqueue_priority_changed() needs to be called for
* <emphasis>every</emphasis> handle for that object if its priority changes.
* The returned handle can be used in calls to g_pqueue_remove() and
* g_pqueue_priority_changed(). Never make such calls for entries that have
* already been removed from the queue. The same @data can be inserted into
* a #GPQueue more than once, but remember that in this case,
* g_pqueue_priority_changed() needs to be called for
* <emphasis>every</emphasis> handle for that object if its priority changes.
* If you need to tell the difference between an empty queue and a queue
* that happens to have a %NULL pointer at the top, check if the queue is
* empty first.
* If you need to tell the difference between an empty queue and a queue
* that happens to have a %NULL pointer at the top, check if the queue is
* empty first.
* Removes the topmost entry from a #GPQueue and returns its data pointer.
* Calling this on an empty #GPQueue is not an error, but removes nothing
* and returns %NULL.
* Removes the topmost entry from a #GPQueue and returns its data pointer.
* Calling this on an empty #GPQueue is not an error, but removes nothing
* and returns %NULL.
* If you need to tell the difference between an empty queue and a queue
* that happens to have a %NULL pointer at the top, check if the queue is
* empty first.
* If you need to tell the difference between an empty queue and a queue
* that happens to have a %NULL pointer at the top, check if the queue is
* empty first.
* Make sure that @entry refers to an entry that is actually part of
* @pqueue at the time, otherwise the behavior of this function is
* undefined (expect crashes).
* Make sure that @entry refers to an entry that is actually part of
* @pqueue at the time, otherwise the behavior of this function is
* undefined (expect crashes).
* Notifies the #GPQueue that the priority of one entry has changed.
* The internal representation is updated accordingly.
* Notifies the #GPQueue that the priority of one entry has changed.
* The internal representation is updated accordingly.
* Make sure that @entry refers to an entry that is actually part of
* @pqueue at the time, otherwise the behavior of this function is
* undefined (expect crashes).
* Make sure that @entry refers to an entry that is actually part of
* @pqueue at the time, otherwise the behavior of this function is
* undefined (expect crashes).
* Do not attempt to change the priorities of several entries at once.
* Every time a single object is changed, the #GPQueue needs to be updated
* by calling g_pqueue_priority_changed() for that object.
* Do not attempt to change the priorities of several entries at once.
* Every time a single object is changed, the #GPQueue needs to be updated
* by calling g_pqueue_priority_changed() for that object.
* This is a special case of g_pqueue_priority_changed(). If you are absolutely
* sure that the new priority of @entry is lower than it was before, you
* may call this function instead of g_pqueue_priority_changed().
* This is a special case of g_pqueue_priority_changed(). If you are absolutely
* sure that the new priority of @entry is lower than it was before, you
* may call this function instead of g_pqueue_priority_changed().
* Deallocates the memory used by @pqueue itself, but not any memory pointed
* to by the data pointers of its entries.
* Deallocates the memory used by @pqueue itself, but not any memory pointed
* to by the data pointers of its entries.