mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Updated comments
This commit is contained in:
parent
35c09b8082
commit
4897c6649d
2 changed files with 29 additions and 5 deletions
|
@ -61,6 +61,24 @@ int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Resize queue
|
||||
|
||||
SYNOPSIS
|
||||
resize_queue()
|
||||
queue Queue
|
||||
max_elements New max size for queue
|
||||
|
||||
NOTES
|
||||
If you resize queue to be less than the elements you have in it,
|
||||
the extra elements will be deleted
|
||||
|
||||
RETURN
|
||||
0 ok
|
||||
1 Error. In this case the queue is unchanged
|
||||
*/
|
||||
|
||||
int resize_queue(QUEUE *queue, uint max_elements)
|
||||
{
|
||||
byte **new_root;
|
||||
|
@ -68,14 +86,16 @@ int resize_queue(QUEUE *queue, uint max_elements)
|
|||
if (queue->max_elements == max_elements)
|
||||
DBUG_RETURN(0);
|
||||
if ((new_root= (byte **) my_realloc((void *)queue->root,
|
||||
(max_elements+1)*sizeof(void*), MYF(MY_WME))) == 0)
|
||||
(max_elements+1)*sizeof(void*),
|
||||
MYF(MY_WME))) == 0)
|
||||
DBUG_RETURN(1);
|
||||
set_if_smaller(queue->elements, max_elements);
|
||||
queue->max_elements=max_elements;
|
||||
queue->root=new_root;
|
||||
queue->max_elements= max_elements;
|
||||
queue->root= new_root;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
void delete_queue(QUEUE *queue)
|
||||
{
|
||||
DBUG_ENTER("delete_queue");
|
||||
|
|
|
@ -120,16 +120,20 @@ void init_thr_alarm(uint max_alarms)
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void resize_thr_alarm(uint max_alarms)
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_alarm);
|
||||
/* it's ok not to shrink the queue sometimes */
|
||||
/*
|
||||
It's ok not to shrink the queue as there may be more pending alarms than
|
||||
than max_alarms
|
||||
*/
|
||||
if (alarm_queue.elements < max_alarms)
|
||||
resize_queue(&alarm_queue,max_alarms+1);
|
||||
pthread_mutex_unlock(&LOCK_alarm);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Request alarm after sec seconds.
|
||||
|
||||
|
|
Loading…
Reference in a new issue