Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishevent3
Commits
385cfc3c
Commit
385cfc3c
authored
Sep 29, 2013
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
varnishevent: encourage re-use of space from the free list
parent
22b77e8b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
data.c
bin/varnishevent/data.c
+14
-1
No files found.
bin/varnishevent/data.c
View file @
385cfc3c
...
...
@@ -39,6 +39,17 @@
#include "vqueue.h"
#include "vsb.h"
/*
* Place the contents of head1 before head2, then empty head2
*/
#define VSTAILQ_PREPEND(head1, head2) do { \
if (!VSTAILQ_EMPTY((head2))) { \
*(head2)->vstqh_last = (head1)->vstqh_first; \
(head1)->vstqh_first = (head2)->vstqh_first; \
VSTAILQ_INIT((head2)); \
} \
} while (0)
static
const
char
*
statename
[
3
]
=
{
"EMPTY"
,
"OPEN"
,
"DONE"
};
static
pthread_mutex_t
freelist_lock
;
...
...
@@ -176,12 +187,14 @@ DATA_Take_Freelist(struct freehead_s *dst)
/*
* return to global freelist
* returned must be locked by caller, if required
* Space is returned to the front of the free list, so that it is likely
* to be re-used
*/
void
DATA_Return_Freelist
(
struct
freehead_s
*
returned
,
unsigned
nreturned
)
{
AZ
(
pthread_mutex_lock
(
&
freelist_lock
));
VSTAILQ_
CONCAT
(
&
freehead
,
returned
);
VSTAILQ_
PREPEND
(
&
freehead
,
returned
);
global_nfree
+=
nreturned
;
AZ
(
pthread_mutex_unlock
(
&
freelist_lock
));
}
...
...
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