Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
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
unique-xids
Commits
a5708d52
Commit
a5708d52
authored
Dec 22, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor reorg of kqueue waiter for improved clarity
parent
23b1f977
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
19 deletions
+33
-19
cache_waiter_kqueue.c
bin/varnishd/waiter/cache_waiter_kqueue.c
+33
-19
No files found.
bin/varnishd/waiter/cache_waiter_kqueue.c
View file @
a5708d52
...
@@ -86,30 +86,41 @@ vwk_kq_sess(struct vwk *vwk, struct sess *sp, short arm)
...
@@ -86,30 +86,41 @@ vwk_kq_sess(struct vwk *vwk, struct sess *sp, short arm)
vwk_kq_flush
(
vwk
);
vwk_kq_flush
(
vwk
);
}
}
/*--------------------------------------------------------------------*/
static
void
static
void
vwk_
k
ev
(
struct
vwk
*
vwk
,
const
struct
kevent
*
kp
)
vwk_
pipe_
ev
(
struct
vwk
*
vwk
,
const
struct
kevent
*
kp
)
{
{
int
i
,
j
;
int
i
,
j
;
struct
sess
*
sp
;
struct
sess
*
ss
[
NKEV
];
struct
sess
*
ss
[
NKEV
];
AN
(
kp
->
udata
);
AN
(
kp
->
udata
);
if
(
kp
->
udata
==
vwk
->
pipes
)
{
assert
(
kp
->
udata
==
vwk
->
pipes
);
j
=
0
;
j
=
0
;
i
=
read
(
vwk
->
pipes
[
0
],
ss
,
sizeof
ss
);
i
=
read
(
vwk
->
pipes
[
0
],
ss
,
sizeof
ss
);
if
(
i
==
-
1
&&
errno
==
EAGAIN
)
if
(
i
==
-
1
&&
errno
==
EAGAIN
)
return
;
while
(
i
>=
sizeof
ss
[
0
])
{
CHECK_OBJ_NOTNULL
(
ss
[
j
],
SESS_MAGIC
);
assert
(
ss
[
j
]
->
fd
>=
0
);
VTAILQ_INSERT_TAIL
(
&
vwk
->
sesshead
,
ss
[
j
],
list
);
vwk_kq_sess
(
vwk
,
ss
[
j
],
EV_ADD
|
EV_ONESHOT
);
j
++
;
i
-=
sizeof
ss
[
0
];
}
assert
(
i
==
0
);
return
;
return
;
while
(
i
>=
sizeof
ss
[
0
])
{
CHECK_OBJ_NOTNULL
(
ss
[
j
],
SESS_MAGIC
);
assert
(
ss
[
j
]
->
fd
>=
0
);
VTAILQ_INSERT_TAIL
(
&
vwk
->
sesshead
,
ss
[
j
],
list
);
vwk_kq_sess
(
vwk
,
ss
[
j
],
EV_ADD
|
EV_ONESHOT
);
j
++
;
i
-=
sizeof
ss
[
0
];
}
}
assert
(
i
==
0
);
}
/*--------------------------------------------------------------------*/
static
void
vwk_sess_ev
(
struct
vwk
*
vwk
,
const
struct
kevent
*
kp
)
{
int
i
;
struct
sess
*
sp
;
AN
(
kp
->
udata
);
assert
(
kp
->
udata
!=
vwk
->
pipes
);
CAST_OBJ_NOTNULL
(
sp
,
kp
->
udata
,
SESS_MAGIC
);
CAST_OBJ_NOTNULL
(
sp
,
kp
->
udata
,
SESS_MAGIC
);
DSL
(
0x04
,
SLT_Debug
,
sp
->
vsl_id
,
"KQ: sp %p kev data %lu flags 0x%x%s"
,
DSL
(
0x04
,
SLT_Debug
,
sp
->
vsl_id
,
"KQ: sp %p kev data %lu flags 0x%x%s"
,
sp
,
(
unsigned
long
)
kp
->
data
,
kp
->
flags
,
sp
,
(
unsigned
long
)
kp
->
data
,
kp
->
flags
,
...
@@ -171,10 +182,13 @@ vwk_thread(void *priv)
...
@@ -171,10 +182,13 @@ vwk_thread(void *priv)
for
(
kp
=
ke
,
j
=
0
;
j
<
n
;
j
++
,
kp
++
)
{
for
(
kp
=
ke
,
j
=
0
;
j
<
n
;
j
++
,
kp
++
)
{
if
(
kp
->
filter
==
EVFILT_TIMER
)
{
if
(
kp
->
filter
==
EVFILT_TIMER
)
{
dotimer
=
1
;
dotimer
=
1
;
continue
;
}
else
if
(
kp
->
filter
==
EVFILT_READ
&&
kp
->
udata
==
vwk
->
pipes
)
{
vwk_pipe_ev
(
vwk
,
kp
);
}
else
{
assert
(
kp
->
filter
==
EVFILT_READ
);
vwk_sess_ev
(
vwk
,
kp
);
}
}
assert
(
kp
->
filter
==
EVFILT_READ
);
vwk_kev
(
vwk
,
kp
);
}
}
if
(
!
dotimer
)
if
(
!
dotimer
)
continue
;
continue
;
...
...
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