Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
4897c664
Commit
4897c664
authored
Oct 15, 2003
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated comments
parent
35c09b80
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
5 deletions
+29
-5
mysys/queues.c
mysys/queues.c
+23
-3
mysys/thr_alarm.c
mysys/thr_alarm.c
+6
-2
No files found.
mysys/queues.c
View file @
4897c664
...
...
@@ -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"
);
...
...
mysys/thr_alarm.c
View file @
4897c664
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment