Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
timeout.c
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
Kirill Smelkov
timeout.c
Commits
1aa993e3
Commit
1aa993e3
authored
Feb 24, 2016
by
William Ahern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'nmathewson-optional_timeout_ptr'
parents
825de345
5ecfc012
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
timeout.c
timeout.c
+11
-4
timeout.h
timeout.h
+4
-1
No files found.
timeout.c
View file @
1aa993e3
...
...
@@ -43,6 +43,11 @@
#include "debug.h"
#endif
#ifdef TIMEOUT_DISABLE_RELATIVE_ACCESS
#define TO_SET_TIMEOUTS(to, T) ((void)0)
#else
#define TO_SET_TIMEOUTS(to, T) ((to)->timeouts = (T))
#endif
/*
* A N C I L L A R Y R O U T I N E S
...
...
@@ -260,7 +265,7 @@ static void timeouts_reset(struct timeouts *T) {
TAILQ_CONCAT
(
&
reset
,
&
T
->
expired
,
tqe
);
TAILQ_FOREACH
(
to
,
&
reset
,
tqe
)
{
to
->
timeouts
=
NULL
;
TO_SET_TIMEOUTS
(
to
,
NULL
)
;
to
->
pending
=
NULL
;
}
}
/* timeouts_reset() */
...
...
@@ -295,7 +300,7 @@ TIMEOUT_PUBLIC void timeouts_del(struct timeouts *T, struct timeout *to) {
}
to
->
pending
=
NULL
;
to
->
timeouts
=
NULL
;
TO_SET_TIMEOUTS
(
to
,
NULL
)
;
}
}
/* timeouts_del() */
...
...
@@ -324,7 +329,7 @@ static void timeouts_sched(struct timeouts *T, struct timeout *to, timeout_t exp
to
->
expires
=
expires
;
to
->
timeouts
=
T
;
TO_SET_TIMEOUTS
(
to
,
T
)
;
if
(
expires
>
T
->
curtime
)
{
rem
=
timeout_rem
(
T
,
to
);
...
...
@@ -547,7 +552,7 @@ TIMEOUT_PUBLIC struct timeout *timeouts_get(struct timeouts *T) {
if
((
to
->
flags
&
TIMEOUT_INT
)
&&
to
->
interval
>
0
)
{
timeouts_readd
(
T
,
to
);
}
else
{
to
->
timeouts
=
0
;
TO_SET_TIMEOUTS
(
to
,
NULL
)
;
}
return
to
;
...
...
@@ -686,6 +691,7 @@ TIMEOUT_PUBLIC struct timeout *timeout_init(struct timeout *to, int flags) {
}
/* timeout_init() */
#ifndef TIMEOUT_DISABLE_RELATIVE_ACCESS
TIMEOUT_PUBLIC
bool
timeout_pending
(
struct
timeout
*
to
)
{
return
to
->
pending
&&
to
->
pending
!=
&
to
->
timeouts
->
expired
;
}
/* timeout_pending() */
...
...
@@ -699,6 +705,7 @@ TIMEOUT_PUBLIC bool timeout_expired(struct timeout *to) {
TIMEOUT_PUBLIC
void
timeout_del
(
struct
timeout
*
to
)
{
timeouts_del
(
to
->
timeouts
,
to
);
}
/* timeout_del() */
#endif
/*
...
...
timeout.h
View file @
1aa993e3
...
...
@@ -119,8 +119,10 @@ struct timeout {
timeout_t
expires
;
/* absolute expiration time */
#ifndef TIMEOUT_DISABLE_RELATIVE_ACCESS
struct
timeouts
*
timeouts
;
/* timeouts collection if member of */
#endif
struct
timeout_list
*
pending
;
/* timeout list if pending on wheel or expiry queue */
...
...
@@ -136,6 +138,7 @@ struct timeout {
TIMEOUT_PUBLIC
struct
timeout
*
timeout_init
(
struct
timeout
*
,
int
);
/* initialize timeout structure (same as TIMEOUT_INITIALIZER) */
#ifndef TIMEOUT_DISABLE_RELATIVE_ACCESS
TIMEOUT_PUBLIC
bool
timeout_pending
(
struct
timeout
*
);
/* true if on timing wheel, false otherwise */
...
...
@@ -144,7 +147,7 @@ TIMEOUT_PUBLIC bool timeout_expired(struct timeout *);
TIMEOUT_PUBLIC
void
timeout_del
(
struct
timeout
*
);
/* remove timeout from any timing wheel (okay if not member of any) */
#endif
/*
* T I M I N G W H E E L I N T E R F A C E S
...
...
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